<?php
if(is_uploaded_file($_FILES["Imgs"]["tmp_name"])){
$phpupfile=$_FILES["Imgs"];
//Output the array structure of the uploaded file;
print_r($phpupfile);
//Output various information of uploaded files
echo $phpupfile["size"]."<br>"; //File name
echo $phpupfile["type"]."<br>"; //File Type
echo $phpupfile["tmp_name"]."<br>"; //The file name contained the path yesterday
echo $phpupfile["name"]."<br>"; //Uploaded file name
/*
* Uploaded error message
* 0 means successful upload,
* 1, 2 means that the maximum upload value set is exceeded
* 3 means only partial uploads
* 4 means no file is uploaded
* 5 means that the upload file size is 0
*/
echo $phpupfile["error"]."<br>";
//Upload function (After submitting the form, the uploaded file has been saved in the server's temporary folder, and 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 sections are additional sections
*/
//Judge whether the file exists. 1 means existence, 0 means not found
echo 'This File is exists:'.file_exists($phpupfile["name"]).'<br>'; //Query whether the file or directory exists
//unlink delete file
echo 'Delete file: '.unlink($phpupfile["name"]).';1 is the deletion successful, 0 is the deletion failed';
//mkdir create folder
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("", "");
echo "<br>";
echo 'This File is exists:'.file_exists($phpupfile["name"]).'<br>';
}
?>