PHP Multi-image Upload simple example, only for beginners friends reference, the programmer's home produced. No reprint is permitted without permission. PHP Multi-image Upload simple example for beginners to refer to friends. Script Academy produced, without permission, no reprint. 1, the Picture upload front page upload.html Note input type=file and enctype= "Multipart/form-data", this is the php file upload key. 2, processing multi-file upload program do_upload.php The following shows the specific upload process: step1:step2: Upload a picture step three: in the actual test process, prompted so that the picture upload failed, log on to the Linux server, the files directory to give writable permissions. As shown in the following: Attached: $_files Array for PHP The contents of the $_files array are as follows: $_files[' myFile ' [' Name '] The original name of the client file. The MIME type of the $_files[' myFile ' [' type '] file requires the browser to provide support for that information, such as "Image/gif". $_files[' myFile ' [' size '] the size of the uploaded file, in bytes. $_files[' myFile ' [' tmp_name '] files are uploaded after the temporary file name stored on the server, usually the system default. Can be specified in the php.ini upload_tmp_dir, but the putenv () function setting is not working. $_files[' myFile ' [' Error '] and the file upload related error code. [' ERROR '] was added in version PHP 4.2.0. Here is a description of it: (they become constants after PHP3.0) UPLOAD_ERR_OK value: 0; No error occurred and the file upload was successful. Upload_err_ini_size value: 1; The uploaded file exceeds the value of the Upload_max_filesize option limit in php.ini. Upload_err_form_size value: 2; The size of the uploaded file exceeds the value specified by the Max_file_size option in the HTML form. Upload_err_partial value: 3; Only part of the file is uploaded. Upload_err_no_file value: 4; No files were uploaded. Value: 5; The upload file size is 0. After the file is uploaded, it is stored in the temp directory by default, and it needs to be removed from the temp directory or moved to another location by the program, and if not, it will be deleted. That is, the files in the temp directory will always be deleted, regardless of the success of the upload or the execution of the script. Therefore, use the copy () function to copy it to another location before deleting it so that the entire upload file process is complete. Well, today's content is introduced here, a very simple example of PHP multi-image upload. Programmer's Home , concentrate on every day for you! |