PHP File Upload-sample code for multiple file uploads

Source: Internet
Author: User
Tags php file upload
php File Upload-sample code for multiple file uploads

PHP supports uploading multiple files at the same time and automatically naming their information as an array, and it is very simple to implement such a function, simply by uploading the domain to the file in the HTML form and using the array submission syntax for the Multi box and check boxes.

Then in the previous "PHP file upload-move_uploaded_file () function" introduced the function of uploading files, just introduced the use of the function, as well as single file upload, this chapter will introduce the implementation of multi-file upload Method!

In the previous article, "PHP comprehensive use of array functions-implementation of multi-file upload," also introduced in PHP, when the browser client submitted a form request to include the uploaded file, PHP will upload the file is temporarily stored in the temporary directory, and then the upload file information stored in the global variable $_ Flies, so we just need to get the information of the uploaded file through the $_files array, and then we can do the corresponding processing operation on it!

The following instance has 4 file upload domain, the file domain name is u_file[], the file information uploaded after submission will be saved to $_files[' u_file '], generate multiple arrays, read the array information, and upload the file, the specific instance code is as follows:

The output results are as follows:

Summarize:

About the file system, we first introduced the basic operation of the file, and then learned the basic operation of the directory, then we learned the file of advanced processing technology, and finally learned the PHP file upload technology. File system is a necessary part of the development of a website, I hope you can understand the key points of knowledge of the file system, master common functions. Next topic we'll be gone!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.