note 109437 modified in features.file-upload.multiple by danbrown
| From: | danbrown@php.net | Date: | Tue, 17 Jul 2012 15:06:04 +0000 |
| Subject: | note 109437 modified in features.file-upload.multiple by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189261@lists.php.net to get a copy of this message | ||
I'am using this to normalize $_FILES array. It's short and clean, normalizes fields
with single upload or multiupload. It uses explicit array
typecast: <?php function
getNormalizedFILES() { 	$newfiles =
array(); 	foreach($_FILES as $fieldname =>
$fieldvalue) 		foreach($fieldvalue as $paramname =>
$paramvalue) 			foreach((array)$paramvalue as $index
=>
$value) 				$newfiles[$fieldname][$index][$paramname] =
$value; 	return $newfiles; } ?>
--was--
I'am using this to normalize $_FILES array. It's short and clean, normalizes fields with
single upload or multiupload. It uses explicit array typecast:
function getNormalizedFILES()
{
$newfiles = array();
foreach($_FILES as $fieldname => $fieldvalue)
foreach($fieldvalue as $paramname => $paramvalue)
foreach((array)$paramvalue as $index => $value)
$newfiles[$fieldname][$index][$paramname] = $value;
return $newfiles;
}
http://php.net/manual/en/features.file-upload.multiple.php