Attention:
1, upload the file, in the HTML form form must be labeled:enctype= ' Multipart/form-data '
2, there is a saying, the request must be in the form form, in front of the FILE with hidden fields such as:<input type=hidden name= ' max_file_size ' value= ' value ' >
File Upload error code:
Predefined variable $_files array has 5 contents:
$_files[' userfile ' [' Name ']--the original name of the client machine file The MIME type of
$_files[' userfile ' [' type ']--file
$_files[' userfile ' [' Size ']--uploaded file sizes in bytes
$_files[' userfile '] [' Tmp_ Name ']--file is uploaded after the temporary file name stored on the server
$_files[' userfile '] ' error ']--and the file upload related error code
where $_files[' userfile ' [' ERROR '] can have the following values and meanings:
0--No error occurred and the file upload was successful. does not have to really have files uploaded, it is possible that you see that size is 0.
1--uploaded a file that exceeds the value of the upload_max_filesize option limit in php.ini . .
2--the size of the uploaded file exceeds the value specified by MAX_FILE_SIZE option in the HTML form. The
3--file is only partially uploaded.
4--no files were uploaded. refers to the form's file field without content, which is an empty string.
Recommended reading: PHP File upload error code
PHP File Upload error code