A php.ini configuration-related matters:
1.file_uploads=on; File upload must be turned on
2.upload_max_filesize= Max upload Size
3.upload_tmp_dir= File Upload Temp folder
The 4.post_max_size must be larger than the upload_max_filesize size
Second: The form submission notes:
1. The form submission must be an HTTP POST
2. form upload requires file form
3.enctype= "Multipart/form-data" only file upload is used
4. Hide the form: max_file_size=; limit the upload size in advance to avoid the file size after uploading in the PHP program;
<input type= "hidden" name= "max_file_size" value= "'. $maxSize. '"/>
Three: Accept the data:
1. Use $_files[] Super Global array; accept the obtained data
2. Copy files to the specified folder using copy ()
Step1: Use $_files[' pic ' [' Error ']; Check for errors
0: Means no errors;
1: Upload beyond the php.ini of the upload_max_filesize;
2: Upload beyond the max_file_size of the form;
3: No files are uploaded
4: Just a few other mistakes.
Step2: Limit file Upload size $_files[' pic ' [' size '];
Step3: Show file type:
1. Use $_files[' pic ' [' type ']===> image/gif image/png Image/ipp
2. Use $_files[' pic ' [' name '] ====>
$arr =explode ('. ', $_files[' pic ' [' name ']);
$arr [Count ($arr)-1];
Step4: Copy the file after uploading it:
Is_uploads_file () to determine if the file was uploaded via http
if ($_files[' pic ' [' tmp_name ']) {
Move_uploaded_file (File,newloc);
}