본문 바로가기
개발/php

php 파일 복사 copy 예제 example

by 향유 2021. 2. 22.

예제 소스

target_tumb의 파일을 복사하여 new_thumb 위치에 파일명으로 복사

$target_thumb = 'uploadFile/board/data1_tn';
$new_thumb = 'uploadFile/newboard/data1_tn';

if(file_exists($target_thumb)) {
 if(!copy($target_thumb, $newer_thumb)) {
  echo '파일 복사 실패';
 }
 else {
  echo '파일 복사 성공';
 }
}

댓글