1. Upload the HTML code of the form
Copy the code The code is as follows:
Copy the code The code is as follows:
if(is_uploaded_file ($_FILES["Imgs"]["tmp_name"])){
$phpupfile=$_FILES["Imgs"];
//Output the array structure of the uploaded file;
print_r($phpupfile);
//Output the uploaded file Various information about the file
echo $phpupfile["size"]."
"; //File name
echo $phpupfile["type"]."
"; //File type
echo $ phpupfile["tmp_name"]."
"; //The file name contains the path yesterday
echo $phpupfile["name"]."
"; //The uploaded file name
/*
* Upload error message
* 0 represents successful upload,
* 1, 2 represents exceeded the set maximum upload value
* 3 represents only partial upload
* 4 represents no file uploaded
* 5 represents uploaded file size is 0
*/
echo $phpupfile["error"]."
";
//Upload function (after submitting the form, the uploaded file has been saved in the temporary folder of the server. At this time, you need to Move it to the specified folder of the website)
move_uploaded_file($phpupfile["tmp_name"],$phpupfile["name"]); //Save the uploaded file to the specified folder
/*
*The following parts are Additional part
*/
//Judge whether the file exists. 1 means it exists, 0 means it is not found.
echo 'This File is exists:'.file_exists($phpupfile["name"]).'
'; // Query whether the file or directory exists
//unlink Delete file
echo 'Delete file:'.unlink($phpupfile["name"]).';1 means deletion is successful, 0 means deletion failed';
//mkdir Create file Clip
if(file_exists('pic')==FALSE){
mkdir("pic");
}
if(file_exists('pic/ts')==FALSE){
mkdir("pic/ts") ;
}
//rmdir Delete folder
if(file_exists('pic/ts')==FALSE){
rmdir('pic/ts');
}
//rename Rename
rename("guitar11- hp-sprite.png", "1.png");
echo "
";
echo 'This File is exists:'.file_exists($phpupfile["name"]).'
' ;
}
?>
The above introduces the experience and experience of learning the mass line education and practice activities. PHP introductory learning knowledge point three PHP upload, including the content of the experience and experience of learning the mass line education and practice activities. I hope it will be helpful to friends who are interested in PHP tutorials.