Analysis of error messages in PHP development file upload tutorial
This requires us to look at it in conjunction with the php.ini file
Open the php.ini file and search for upload
##Look at the following and ask us to put 882 Change the On line to off and then restart the serverThen run, the effect is as follows:Output an empty array887 line upload_tmp_dir = Directory where temporary files are stored Line 891 upload_max_filesize = 2M The size of files allowed to be uploaded is 2 MB Line 894 uploads = 20 The maximum number of files allowed to be uploaded at one time is 20 So we write the error message as a switch statement switch ($error){ case 1: echo "The uploaded file exceeds the value of upload_max_filesize in the php configuration file"; break;
case 2: echo "The uploaded file exceeds max_file_size";break;
case 3: echo "The file was partially uploaded";break;
case 4: echo "No file was selected to upload";break;
case 6: echo "Temporary directory not found";break;
case 7:
case 8: echo "System error";break;
}