src/UploadedFile.php
public static function sanitizeFileData($files)
    {
        $result = [];

        foreach ($files as $field => $data) {
            foreach ($data as $val) {
                $result[$field] = [];
                if (!is_array($val)) {
                    $result[$field] = $data;
                } else {
                    $res = [];
                    self::filesFlip($res, [], $data);
                    $result[$field] += $res;
                }
            }
        }

        return $result;
    }
public static function sanitizeFileData($files)
    {
        $result = [];

        foreach ($files as $field => $data) {
            foreach ($data as $val) {
                $result[$field] = [];
                if (!is_array($val)) {
                    $result[$field] = $data;
                } else {
                    $res = [];
                    self::filesFlip($res, [], $data);
                    $result[$field] += $res;
                }
            }
        }

        return $result;
    }
Sanitizes the data from $_FILES and returns them as a proper form-input style value, with recursive support.

@param array $files The $_FILES array to sanitize.

@return array

@author Bart Kelsey <http://www.opengameart.org>
@see    https://stackoverflow.com/questions/5444827/how-do-you-loop-through-files-array/29664753#29664753