I have a simple HTML form that has 5 of the following inputs:

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

I post this to my script for processing and the array becomes this:

$_FILES['multi']['attribute'][0]

Where ['attribute'] are the typical values associated with a file upload and [0] indicates the file in the array. So with 5 upload files this would go from [0] - [4]

I'm looking for guidance to achieve the following:

  1. Echo the name, type, and filesize of each file in the array to the screen
  2. use exec() to move these files to a specified directory

I know I need to use foreach() but I haven't used it often in my programs so any help is greatly appreciated.

Thanks in advance!

    I think what you want is something like:

    foreach($_FILES['multi']['name'] as $ix) {
        // do stuff with $_FILE['multi']['<any_key>'][$ix]
    }
    
      Write a Reply...