I have an upload form that allows the user to upload multiple files but I don't know how to handle it once the form is submitted.
I am assuming a foreach loop but I don't know how to implement that.
The fields will be name image_1, image_2, etc.
Any help would be appreciated.
Handle multiple file upload
Moderator: General Moderators
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Handle multiple file upload
Loop over $_FILES
Code: Select all
foreach ($_FILES as $file) {
// do something with $file
}Re: Handle multiple file upload
With this, would $file become an array with the tmp_name, size, and type and all that?Jonah Bron wrote:Loop over $_FILES
Code: Select all
foreach ($_FILES as $file) { // do something with $file }
ie:
Code: Select all
$file['tmp_name']- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Handle multiple file upload
Perfect. Thanks for the help.