Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9202789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:20:02+00:00 2026-06-17T23:20:02+00:00

I have this file upload input in a form: <input type=file multiple name=file[] />

  • 0

I have this file upload input in a form:

<input type="file"  multiple name="file[]" />

I have a script which appends this multiple times within the form.

Could I determine which row each file[] array belongs to in php?

<?php 
if(isset($_FILES['file'])=== true){
$files = array ($_FILES['file']);
}
    var_dump($files);

?>

array (size=1)
  0 => 
array (size=5)
  'name' => 
    array (size=5)
      0 => string 'IMG_8502 f 5 .jpg' (length=17)
      1 => string 'IMG_8507 f 5 .jpg' (length=17)
      2 => string 'IMG_8508 f 5 .jpg' (length=17)
      3 => string 'IMG_8529 f 5 .jpg' (length=17)
      4 => string 'IMG_8612 fff 5 .jpg' (length=19)
  'type' => 
    array (size=5)
      0 => string 'image/jpeg' (length=10)
      1 => string 'image/jpeg' (length=10)
      2 => string 'image/jpeg' (length=10)
      3 => string 'image/jpeg' (length=10)
      4 => string 'image/jpeg' (length=10)
  'tmp_name' => 
    array (size=5)
      0 => string 'C:\wamp\tmp\phpE892.tmp' (length=23)
      1 => string 'C:\wamp\tmp\phpE8D1.tmp' (length=23)
      2 => string 'C:\wamp\tmp\phpE911.tmp' (length=23)
      3 => string 'C:\wamp\tmp\phpE950.tmp' (length=23)
      4 => string 'C:\wamp\tmp\phpE99F.tmp' (length=23)
  'error' => 
    array (size=5)
      0 => int 0
      1 => int 0
      2 => int 0
      3 => int 0
      4 => int 0
  'size' => 
    array (size=5)
      0 => int 2776165
      1 => int 2380025
      2 => int 2456713
      3 => int 2585779
      4 => int 1770128

I would like to get each set of files uploaded into their own array. In other words name 0-4 set to be array 0 and then for the next set of files uploaded in the next row to be array 1 and so on. so i can store each set of files with their associated text in the form

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:20:03+00:00Added an answer on June 17, 2026 at 11:20 pm
    <?php
    if(isset($_FILES['userfile'])=== true){
      $files = array ($_FILES['userfile']);
      echo  '<pre>';
      print_r($_FILES['userfile']);
      echo  '</pre>';
    }
    ?>
    
    
    <form action="" method="post" enctype="multipart/form-data">
      Send these files:<br />
        set one:<br>
      <input name="userfile[0][]" type="file" /><br />
      <input name="userfile[0][]" type="file" /><br />
      set two:<br>
      <input name="userfile[1][]" type="file" /><br />
      <input name="userfile[1][]" type="file" /><br />
    
      <input type="submit" value="Send files" />
    </form>
    

    Test output:

    Array
    (
        [name] => Array
            (
                [0] => Array
                    (
                        [0] => Chrysanthemum.jpg
                        [1] => Desert.jpg
                        [2] => Hydrangeas.jpg
                        [3] => Jellyfish.jpg
                    )
    
                [1] => Array
                    (
                        [0] => Koala.jpg
                        [1] => Lighthouse.jpg
                        [2] => Penguins.jpg
                        [3] => Tulips.jpg
                    )
    
            )
    
        [type] => Array
            (
                [0] => Array
                    (
                        [0] => image/jpeg
                        [1] => image/jpeg
                        [2] => image/jpeg
                        [3] => image/jpeg
                    )
    
                [1] => Array
                    (
                        [0] => image/jpeg
                        [1] => image/jpeg
                        [2] => image/jpeg
                        [3] => image/jpeg
                    )
    
            )
    
        [tmp_name] => Array
            (
                [0] => Array
                    (
                        [0] => C:\xampp\tmp\php4095.tmp
                        [1] => C:\xampp\tmp\php40B5.tmp
                        [2] => C:\xampp\tmp\php40C6.tmp
                        [3] => C:\xampp\tmp\php40C7.tmp
                    )
    
                [1] => Array
                    (
                        [0] => C:\xampp\tmp\php40D7.tmp
                        [1] => C:\xampp\tmp\php40D8.tmp
                        [2] => C:\xampp\tmp\php40D9.tmp
                        [3] => C:\xampp\tmp\php40EA.tmp
                    )
    
            )
    
        [error] => Array
            (
                [0] => Array
                    (
                        [0] => 0
                        [1] => 0
                        [2] => 0
                        [3] => 0
                    )
    
                [1] => Array
                    (
                        [0] => 0
                        [1] => 0
                        [2] => 0
                        [3] => 0
                    )
    
            )
    
        [size] => Array
            (
                [0] => Array
                    (
                        [0] => 879394
                        [1] => 845941
                        [2] => 595284
                        [3] => 775702
                    )
    
                [1] => Array
                    (
                        [0] => 780831
                        [1] => 561276
                        [2] => 777835
                        [3] => 620888
                    )
    
            )
    
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form: <form action=image_upload.php method=post enctype=multipart/form-data> Image 1: <input type=file name=event_image />
I'm setting a form so i can upload multiple files: <div> <input type=hidden name=MAX_FILE_SIZE
i have a simple form: <input type=hidden name=MAX_FILE_SIZE value=2097152 id=MAX_FILE_SIZE> <input type=file name=file_upload id=file_upload
I'm using this plugin: jQuery File Upload My HTML: <input id=fileupload type=file name=files[] data-url=upload.php
I have this xml file which has text init. i.e Hi my name is
I have an Ajax file upload with this code: $('#photo-input:file').change(function() { var photo =
I have a file upload form set up with the HTML5 multiple attribute. However,
I have string like this: G:\Projects\TestApp\TestWeb\Files\Upload\file.jpg How can I remove all text before Files
In the web page, I have file upload widget. I need to show this
I have one audio file captured from my iphone. I want to upload this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.