src/Forms/FileUploadReceiver.php
protected function extractUploadedFileData($postVars)
    {
        // Note: Format of posted file parameters in php is a feature of using
        // <input name='{$Name}[Uploads][]' /> for multiple file uploads
        $tmpFiles = array();
        if (!empty($postVars['tmp_name'])
            && is_array($postVars['tmp_name'])
            && !empty($postVars['tmp_name']['Uploads'])
        ) {
            for ($i = 0; $i < count($postVars['tmp_name']['Uploads']); $i++) {
                // Skip if "empty" file
                if (empty($postVars['tmp_name']['Uploads'][$i])) {
                    continue;
                }
                $tmpFile = array();
                foreach (array('name', 'type', 'tmp_name', 'error', 'size') as $field) {
                    $tmpFile[$field] = $postVars[$field]['Uploads'][$i];
                }
                $tmpFiles[] = $tmpFile;
            }
        } elseif (!empty($postVars['tmp_name'])) {
            // Fallback to allow single file uploads (method used by AssetUploadField)
            $tmpFiles[] = $postVars;
        }

        return $tmpFiles;
    }
protected function extractUploadedFileData($postVars)
    {
        // Note: Format of posted file parameters in php is a feature of using
        // <input name='{$Name}[Uploads][]' /> for multiple file uploads
        $tmpFiles = array();
        if (!empty($postVars['tmp_name'])
            && is_array($postVars['tmp_name'])
            && !empty($postVars['tmp_name']['Uploads'])
        ) {
            for ($i = 0; $i < count($postVars['tmp_name']['Uploads']); $i++) {
                // Skip if "empty" file
                if (empty($postVars['tmp_name']['Uploads'][$i])) {
                    continue;
                }
                $tmpFile = array();
                foreach (array('name', 'type', 'tmp_name', 'error', 'size') as $field) {
                    $tmpFile[$field] = $postVars[$field]['Uploads'][$i];
                }
                $tmpFiles[] = $tmpFile;
            }
        } elseif (!empty($postVars['tmp_name'])) {
            // Fallback to allow single file uploads (method used by AssetUploadField)
            $tmpFiles[] = $postVars;
        }

        return $tmpFiles;
    }
protected function extractUploadedFileData ( $ postVars ) { // Note: Format of posted file parameters in php is a feature of using // <input name='{$Name}[Uploads][]' /> for multiple file uploads $ tmpFiles = array ( ) ; if ( ! empty ( $ postVars [ 'tmp_name' ] ) && is_array ( $ postVars [ 'tmp_name' ] ) && ! empty ( $ postVars [ 'tmp_name' ] [ 'Uploads' ] ) ) { for ( $ i = 0 ; $ i < count ( $ postVars [ 'tmp_name' ] [ 'Uploads' ] ) ; $ i ++ ) { // Skip if "empty" file if ( empty ( $ postVars [ 'tmp_name' ] [ 'Uploads' ] [ $ i ] ) ) { continue ; } $ tmpFile = array ( ) ; foreach ( array ( 'name' , 'type' , 'tmp_name' , 'error' , 'size' ) as $ field ) { $ tmpFile [ $ field ] = $ postVars [ $ field ] [ 'Uploads' ] [ $ i ] ; } $ tmpFiles [ ] = $ tmpFile ; } } elseif ( ! empty ( $ postVars [ 'tmp_name' ] ) ) { // Fallback to allow single file uploads (method used by AssetUploadField) $ tmpFiles [ ] = $ postVars ; } return $ tmpFiles ; }
Given an array of post variables, extract all temporary file data into an array

@param array $postVars Array of posted form data
@return array List of temporary file data
Given an array of post variables extract all temporary file data into an array