From 38571d552f24ed46ac31c35ba92bf7b4aec6d2e1 Mon Sep 17 00:00:00 2001 From: thisgun Date: Tue, 16 Mar 2021 12:17:52 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8F=99=EC=9D=BC=20=EA=B2=8C=EC=8B=9C?= =?UTF-8?q?=EA=B8=80=20=EB=B3=B5=EC=82=AC=EC=8B=9C=20=EC=B2=A8=EB=B6=80?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EB=AA=85=20=EA=B8=B8=EC=9D=B4=EA=B0=80=20?= =?UTF-8?q?=EB=8A=98=EC=96=B4=EB=82=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/move_update.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bbs/move_update.php b/bbs/move_update.php index 595e6f5a6..097af6863 100644 --- a/bbs/move_update.php +++ b/bbs/move_update.php @@ -130,7 +130,20 @@ while ($row = sql_fetch_array($result)) { // 원본파일을 복사하고 퍼미션을 변경 // 제이프로님 코드제안 적용 - $copy_file_name = ($bo_table !== $move_bo_table) ? $row3['bf_file'] : $row2['wr_id'].'_copy_'.$insert_id.'_'.$row3['bf_file']; + + $copy_file_name = $row3['bf_file']; + + if($bo_table === $move_bo_table){ + if(preg_match('/_copy(\d+)?_(\d+)_/', $copy_file_name, $match)){ + + $number = isset($match[1]) ? (int) $match[1] : 0; + $replace_str = '_copy'.($number + 1).'_'.$insert_id.'_'; + $copy_file_name = preg_replace('/_copy(\d+)?_(\d+)_/', $replace_str, $copy_file_name); + } else { + $copy_file_name = $row2['wr_id'].'_copy_'.$insert_id.'_'.$row3['bf_file']; + } + } + $is_exist_file = is_file($src_dir.'/'.$row3['bf_file']) && file_exists($src_dir.'/'.$row3['bf_file']); if( $is_exist_file ){ @copy($src_dir.'/'.$row3['bf_file'], $dst_dir.'/'.$copy_file_name);