note 103104 added to features.file-upload.multiple
| From: | bruno at d2web dot com dot br | Date: | Fri, 25 Mar 2011 21:19:33 +0000 |
| Subject: | note 103104 added to features.file-upload.multiple | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178215@lists.php.net to get a copy of this message | ||
Here is another function to fix the array of uploaded files.
/**
* Fix an array of uploaded files to the following format:
*
* $_FILES[fieldname][0, 1, 2...][attr]
*
* @author Bruno Lacerda
*/
function fix_input_files($files)
{
$entries = array('name', 'type', 'tmp_name', 'error',
'size');
$files_count = count($files['name']);
// We'll create a new array and run uploaded files.
for ( $pointer = 0; $pointer <= $files_count; ++ $pointer )
{
$files[$pointer] = array();
foreach ( $entries as $entry ):
// Add each entry with it's value to our new array.
foreach ( $files[$entry] as $i => $value ) {
$files[$pointer][$entry] = $value;
}
endforeach;
}
// Unset default entryes at files array.
return array_slice($files, 5);
}
----
Server IP: 69.147.83.197
Probable Submitter: 201.82.18.83
----
Manual Page -- http://www.php.net/manual/en/features.file-upload.multiple.php
Edit -- https://master.php.net/note/edit/103104
Del: integrated -- https://master.php.net/note/delete/103104/integrated
Del: useless -- https://master.php.net/note/delete/103104/useless
Del: bad code -- https://master.php.net/note/delete/103104/bad+code
Del: spam -- https://master.php.net/note/delete/103104/spam
Del: non-english -- https://master.php.net/note/delete/103104/non-english
Del: in docs -- https://master.php.net/note/delete/103104/in+docs
Del: other reasons-- https://master.php.net/note/delete/103104
Reject -- https://master.php.net/note/reject/103104
Search -- https://master.php.net/manage/user-notes.php