<?php
 
if(!empty($_FILES["magfile"]))
  {
   
$uploaddir = $_SERVER['DOCUMENT_ROOT']."/dainsider/magazines/";
   
$uploaddir.="magazine.pdf";
   
   
//Copy the file to some permanent location
   
if(move_uploaded_file($_FILES["magfile"]["tmp_name"], $uploaddir))
    {
      echo
"Magazine Updated!";
    }
    else
    {
      echo
"There was a problem when uploding the new file, please contact ".$admin_email." about this.";
     
print_r($_FILES);
    }
  }
?>

위에서 처럼 DOCUMENT_ROOT 를 사용하여 절대경로로 사용.
뭣보다 TRUE, FALSE 를 반환해주고 파일 카피가 아닌 move 기능

업로드 함수를 사용할때 유용
Posted by 철냄비짱
,