Jump to content

Recommended Posts

I am new to this so this is probably a stupid question but, how do I access [userfile1] and [userfile2] in the following code to write a foreach statement that runs on each of those arrays in $_FILES. For context: these files populate $_FILES via an html form with two browse buttons - one for each file to upload - and one submit button. The following output was produced with

<pre><?php print_r($_FILES); ?> </pre>

. Any help is appreciated. Thanks.

 

Array

(

[userfile1] => Array

(

[name] => Hay-Bales-LeoKenney.jpg

[type] => image/jpeg

[tmp_name] => C:\wamp\tmp\php441.tmp

[error] => 0

=> 356369

)

 

[userfile2] => Array

(

[name] => LK-Holding on.jpg

[type] => image/jpeg

[tmp_name] => C:\wamp\tmp\php442.tm

[error] => 0

=> 312401

)

 

)

Link to comment
https://forums.phpfreaks.com/topic/274412-accessing-multiple-arrays-in-_files/
Share on other sites

you loop through the arrays by following the example in the link I gave, giving the file inputs the name="userfile[]".

 

You have given them different names so no looping.

Edited by Barand
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.