: This article mainly introduces the PHP file upload function. For more information about PHP tutorials, see. Only implement a small Upload function, and do not pay too much attention to the quality of the code
Html
Test the phpUpload new file to website
Test3.php
0) {echo "upload error "."
"; Exit;} else {echo" upload OK "."
";} If (file_exists ("/var/www/". $ _ FILES ['userfile'] ['name']) {echo" file already exists "."
"; Exit;} else {move_uploaded_file ($ _ FILES ['userfile'] ['tmp _ name'],"/var/www /". $ _ FILES ['userfile'] ['name']); // you must modify the upload file name. Otherwise, the uploaded file echo "upload finished will be automatically deleted after the script exits.
";}?>
Note: configuration of uploaded parameters in the php. ini file
File_uploads, upload_tmp_dir, upload_max_filesize, post_max_size
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above introduces the PHP file upload function, including some content, and hope to be helpful to friends who are interested in PHP tutorials.