note 111561 deleted from features.file-upload.post-method by peehaa
| From: | peehaa@php.net | Date: | Sun, 28 Apr 2019 10:45:12 +0000 |
| Subject: | note 111561 deleted from features.file-upload.post-method by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210811@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Normalizing $_FILES structure:
<?php
$files = [];
$fix = function (&$files, $values, $prop) use (&$fix) {
foreach ($values as $key => $value) {
if (is_array($value)) {
$fix($files[$key], $value, $prop);
} else {
$files[$key][$prop] = $value;
}
}
};
foreach ($_FILES as $name => $props) {
foreach ($props as $prop => $value) {
if (is_array($value)) {
$fix($files[$name], $value, $prop);
} else {
$files[$name][$prop] = $value;
}
}
}
?>