Posted By

openone on 09/18/12


Tagged

textmate FILES+file+upload


Versions (?)

Restructure+$_FILES+array


 / Published in: PHP
 

  1. foreach ($_FILES as $key_ => $file) {
  2. foreach ($file as $key => $data) {
  3. foreach ($data as $model => $fields) {
  4. if (is_array($fields)) {
  5. foreach ($fields as $field => $value) {
  6. if (is_array($value)) {
  7. foreach ($value as $k => $v) {
  8. $files[$key_][$model][$field][$k][$key] = $v;
  9. }
  10. } else {
  11. $files[$key_][$model][$field][$key] = $value;
  12. }
  13. }
  14. } else {
  15. $files[$key_][$model][$key] = $fields;
  16. }
  17. }
  18. }
  19. }
  20.  
  21. echo '<pre>';
  22. var_export($files);
  23. echo '</pre>';

Report this snippet  

You need to login to post a comment.