当我将其作为数组获取时,只获取输入类型“文件”的名称和扩展名

I am trying something I just learned about which is html form arrays and I am trying that with files now like this

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

When I loop the array in a foreach I see that it only saved the name of the file and extension. Where can I find stuff like its directory?

Foreach loop I perform

$image = $_FILES['image_name'];
foreach($image as $oneImage){
  echo $image[0];
}

This actually does work

$image = $_FILES['image_name'];
foreach($image['tmp_name'] as $oneImage){
  echo $image;
}

I need this but without asking for tmp_name in the foreach condition itself.

Also I need to ask for the number 0 instead of 'name'. It's not that much of a problem but is it possible to change that?

Edit:

I just performed a print_r on the foreach array and it gave me this:

Array ( [0] => 3.jpg [1] => 5585_387497301371274_1740842451_n.png ) 
Array ( [0] => image/jpeg [1] => image/png ) 
Array ( [0] => /tmp/phpIlm34I [1] => /tmp/phpX7EHX4 ) 
Array ( [0] => 0 [1] => 0 ) 
Array ( [0] => 56405 [1] => 504664 ) 

How would I ask for the tmp_name there? Those are from 2 files and let's say I wan't /tmp/phpIlm34I

You will never see the original file directory. Thats the way it is made, mostly for security reasons.

Where can I find stuff like its directory?

You can't as there are three things only (Reference)

  • name - The file's name as a read-only string. This is just the file name, and does not include any path information.
  • size - The size of the file in bytes as a read-only 64-bit integer.
  • type - The MIME type of the file as a read-only string, or "" if the type couldn't be determined.