Multiple selection / multiple upload

See all posts See thread Reply

Re: Multiple selection / multiple upload new!
by colin, 15 years ago
The foreach() loops are to be used only if you have multiple upload fields.

In your case, you have only one field my_field. You can instanciate the class directly without looping through the $_FILES array.

If you want multiple upload fields, you need to have several fields in your form, and then you will have to loop through $_FILES as in the FAQ. To have several fields, you would need to have something like this in your form:
<input type="file" size="32" name="my_field[]" value="" />
<input type="file" size="32" name="my_field[]" value="" />
<input type="file" size="32" name="my_field[]" value="" />
Reply