Reply to Re: multiple files upload

Re: multiple files upload new!
by colin, 16 years, 9 months ago
Read the FAQ again. If you do multiple uploads, you have to change the $_FILES array.

$files = array();
foreach ($_FILES['my_field'] as $k => $l) {
 foreach ($l as $i => $v) {
 if (!array_key_exists($i, $files)) 
   $files[$i] = array();
   $files[$i][$k] = $v;
 }
} 

Then you can use $files rather than $_FILES in your code. Note that you can trim out all non-uploaded images in the code above.Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important