Ignore:
Timestamp:
12/20/10 15:05:48 (13 years ago)
Author:
eduardoalex
Message:

Ticket #1408 - Adição de envio de anexos, normal e no forward

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/mobile/inc/class.common_functions.inc.php

    r3573 r3609  
    6363                } 
    6464                 
     65                /** 
     66                 * Fixes the odd indexing of multiple file uploads from the format: 
     67                 * 
     68                 * $_FILES['field']['key']['index'] 
     69                 * 
     70                 * To the more standard and appropriate: 
     71                 * 
     72                 * $_FILES['field']['index']['key'] 
     73                 * 
     74                 * @param array $files 
     75                 * @author Corey Ballou 
     76                 * @link http://www.jqueryin.com 
     77                 */ 
     78                function fixFilesArray(&$files) 
     79                { 
     80                    $names = array( 'name' => 1, 'type' => 1, 'tmp_name' => 1, 'error' => 1, 'size' => 1); 
     81                 
     82                    foreach ($files as $key => $part) { 
     83                        // only deal with valid keys and multiple files 
     84                        $key = (string) $key; 
     85                        if (isset($names[$key]) && is_array($part)) { 
     86                            foreach ($part as $position => $value) { 
     87                                $files[$position][$key] = $value; 
     88                            } 
     89                            // remove old key reference 
     90                            unset($files[$key]); 
     91                        } 
     92                    } 
     93                } 
     94                 
    6595        } //end common class 
    6696         
Note: See TracChangeset for help on using the changeset viewer.