note 53479 added to features.file-upload.multiple

From: Date: Thu, 02 Jun 2005 18:27:56 +0000
Subject: note 53479 added to features.file-upload.multiple
Groups: php.notes 
Request: Send a blank email to php-notes+get-89828@lists.php.net to get a copy of this message
Elaboration on phpuser at gmail dot com reArrayFiles() function (which assumed sequential, integer keys and uni-dimensional), this function will work regardless of key and key depth: <?php // information grouper function groupFileInfoByVariable(&$top, $info, $attr) { if (is_array($info)) { foreach ($info as $var => $val) { if (is_array($val)) { groupFileInfoByVariable($top[$var], $val, $attr); } else { $top[$var][$attr] = $val; } } } else { $top[$attr] = $info; } return true; } // usage $newOrdering = array (); foreach ($_FILES as $var => $info) { foreach (array_keys($info) as $attr) { groupFileInfoByVariable($newOrdering, $info[$attr], $attr); } } // $newOrdering holds the updated order ?> ---- Manual Page -- http://www.php.net/manual/en/features.file-upload.multiple.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53479 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53479&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53479&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53479&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53479&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53479&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53479&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#89828) next »