Organizational Research By

Surprising Reserch Topic

How can I select and upload multiple files with HTML and PHP, using HTTP POST?

I have experience doing this with single file uploads using . However, I am having trouble doing uploading more than one at a time.

For example, I'd like to be able to select a series of images, then upload them to the server, all at once.

It would be great to use a single file input control, if po

asked Apr 13, 2015 in codeinither by rajesh
0 votes

Related Hot Questions

1 Answer

0 votes
his is possible in HTML5. Example (PHP 5.4):

                     if (isset($_FILES['my_file'])) {
                $myFile = $_FILES['my_file'];
                $fileCount = count($myFile["name"]);

                for ($i = 0; $i < $fileCount; $i++) {

File #:



                            Temporary file:






Here's what it looks like in Chrome after selecting 2 items in the file dialog:

chrome multiple file select

And here's what it looks like after clicking the "Upload" button.

submitting multiple files to PHP

This is just a sketch of a fully working answer. See PHP Manual: Handling file uploads for more information on proper, secure handling of file uploads in PHP.
answered Apr 13, 2015 by rajesh