note 105143 deleted from features.file-upload.post-method by danbrown
| From: | danbrown@php.net | Date: | Mon, 01 Aug 2011 13:51:27 +0000 |
| Subject: | note 105143 deleted from features.file-upload.post-method by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182064@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Function to flatten the _FILES array into the format mentioned in an earlier post. The group name
is for when an array of files are upload, 'photos[]' for example.
function _flatten_files_array($group_name)
{
if(empty($_FILES[$group_name]))
{
return array();
}
$new_files_array = array();
foreach($_FILES[$group_name] as $key => $attr)
{
foreach($attr as $index => $val)
{
if(!is_array($new_files_array[$index]))
{
$new_files_array[$index] = array();
}
$new_files_array[$index][$key] = $val;
}
}
return $new_files_array;
}