Data Analysis for Investment & Control

PHP - move_uploaded_file() 본문

Code/WEB

PHP - move_uploaded_file()

아슈람 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");
    }
}
?>


끝!
반응형
Comments