For situation download[file1], download[file2], ..., download[fileN], try it:
<?php
function rRestructuringFilesArray(&$arrayForFill, $currentKey, $currentMixedValue, $fileDescriptionParam)
{
if (is_array($currentMixedValue)) {
foreach ($currentMixedValue as $nameKey => $mixedValue) {
rRestructuringFilesArray($arrayForFill[$currentKey],
$nameKey,
$mixedValue,
$fileDescriptionParam);
}
} else {
$arrayForFill[$currentKey][$fileDescriptionParam] = $currentMixedValue;
}
}
$arrayForFill = array();
foreach ($_FILES as $firstNameKey => $arFileDescriptions) {
foreach ($arFileDescriptions as $fileDescriptionParam => $mixedValue) {
rRestructuringFilesArray($arrayForFill,
$firstNameKey,
$_FILES[$firstNameKey][$fileDescriptionParam],
$fileDescriptionParam);
}
}
$_FILES = $arrayForFill;
?>