The Problem:
Hi! I'm making a file upload form where I can upload photos, I added multiple=""
to the input
and for the name="upload_photo[]"
so I'm able to upload multiple files. When I print $_FILES['upload_photo']
I get this and I want to get the values
of each key
with foreach
.
So for example I want to get just [name]
what will be egg.jpg
and green.jpg
.
Array
(
[name] => Array
(
[0] => egg.jpg
[1] => green.jpg
)
[type] => Array
(
[0] => image/jpeg
[1] => image/jpeg
)
[tmp_name] => Array
(
[0] => C:\wamp\tmp\php50E9.tmp
[1] => C:\wamp\tmp\php50EA.tmp
)
[error] => Array
(
[0] => 0
[1] => 0
)
[size] => Array
(
[0] => 24450
[1] => 65030
)
)
This is what I have tried so far
But this gives me everything I don't have control over it.
foreach($_FILES['upload_photo'] as $keys => $file){
foreach($_FILES['upload_photo'][$keys] as $key => $files){
echo $files . "<br />";
}
}