PHP HTML5 multi-file upload


/ Published in: PHP
Save to your folder(s)

Uploading multiple files at once used to be strictly in the realm of flash or required javascript to crate multiple upload forms as needed. The first method has the problems with the general incompatibility of flash. The second, well, it's a very low tech method and limits you to selecting only one file per upload form, real pain.

First is the HTML form. Pretty standard all you gotta do is add the multiple tag and add brakets to the variable name. Those brakets are the key to the next set, they tell PHP to make the variable an array.

Then is the PHP code. First thing you have to do is get the number of files, I used the count() on an variable then run through till you hit the count, using the variable in each $_FIES call. It's easy to retrofit an older system this way.

An example of the above code can be found at the link.

URL: http://fatfolderdesign.com/167/unimportant/html5-mulit-upload

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.