Created
April 26, 2016 20:03
-
-
Save Luciaisacomputer/f072988640dd87ef43b8965ba4faa9ba to your computer and use it in GitHub Desktop.
This helps make the $_FILES global array less clunky and easier to iterate over
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function reArrayFiles(&$file_post) { | |
$file_ary = array(); | |
$file_count = count($file_post['name']); | |
$file_keys = array_keys($file_post); | |
for ($i=0; $i<$file_count; $i++) { | |
foreach ($file_keys as $key) { | |
$file_ary[$i][$key] = $file_post[$key][$i]; | |
} | |
} | |
return $file_ary; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file_ary = reArrayFiles($_FILES['contentUploads']); | |
foreach ($file_ary as $file) { | |
print $file['name']; | |
print $file['type']; | |
print $file['size']; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment