관리 메뉴

Data Analysis for Investment & Control

PHP - move_uploaded_file() 본문

Code/PHP

PHP - move_uploaded_file()

Jeongseob.Kim 2010.10.25 14:42

파일을 업로드 할 때 사용하는 함수입니다.

정의는 아래와 같습니다.

bool move_uploaded_file ( string $filename , string $destination )


Parameters
filename : The filename of the uploaded file.
destination : The destination of the moved file.

Return Values
If filename is not a valid upload file, then no action will occur, and move_uploaded_file() will return FALSE.
If filename is a valid upload file, but cannot be moved for some reason, no action will occur, and move_uploaded_file() will return FALSE. Additionally, a warning will be issued.


예제)

 $error) {
    if ($error == UPLOAD_ERR_OK) {
        $tmp_name = $_FILES["pictures"]["tmp_name"][$key];
        $name = $_FILES["pictures"]["name"][$key];
        move_uploaded_file($tmp_name, "$uploads_dir/$name");
    }
}
?>


끝!

'Code > PHP' 카테고리의 다른 글

PHP - $_FILES  (0) 2010.10.25
PHP - serialize() / unserialize()  (0) 2010.10.25
PHP - move_uploaded_file()  (0) 2010.10.25
      
0 Comments
댓글쓰기 폼