Home >Backend Development >PHP Tutorial >Understand how PHP file upload works
Principle analysis: //Form uploads can only use multipart/form-data encoding format $_FILES system function; $_FILES['myFile']['name']File name $_FILES['myFile']['type'] file type, restricted by the server image/** image/x-png application/x-zip-compressed $_FILES['myFile']['size']Upload file size $_FILES['myFile']['tmp_name'] saves the temporary file name after uploading the service $_FILES['myFile']['error'] error code; 0 Success 1 Exceeded php.ini size 2 Exceeded the value specified by the MAX_FILE_SIZE option 3Only partial upload 5Uploaded file size is 0 move_uploaded_file (temporary file, target location and file name); Function to move files to the target location after uploading is_uploaded_file(MIME); Function to determine uploaded MIME type of file |