I have a html form sending to php script with "post" method (no ajax involved).
In the form i have some type="file"
fields.
Now in my php script i have a php foreach loop looping through the sent files:
foreach($_FILES as $file) {
// Some checks and actions.
}
In that loop i want to be able to use the current file array name (which is equal to the name attribute of the upload filled it was uploaded from of course), so i treid:
foreach($_FILES as $file) {
// Some checks and actions.
print ($file);
}
But that's just echoing "Array".
Important note: My $_FILES array is structured like that:
Array
(
[_pf_photo1] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
[_pf_photo2] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
[_pf_photo3] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
[_pf_photo4] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
[_pf_photo5] => Array
(
[name] =>
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
[selfimage] => Array
(
[name] => IMG_9785.JPG
[type] => image/jpeg
[tmp_name] => /tmp/phpWMOKhn
[error] => 0
[size] => 104221
)
)
($_FILES
can be structured another way, so to make things clear). so in that example what i want to get in the loop (for the array name part) is:
_pf_photo1, _pf_photo2, _pf_photo3, _pf_photo4, _pf_photo5, selfimage