src/Message/Server/UploadedFilesFactory.php
private function saneFilesArray(array $files)
    {
        $result = [];

        foreach ($files as $field => $data) {
            foreach ($data as $key => $val) {
                $result[$field] = [];
                if (!is_array($val)) {
                    $result[$field] = $data;
                    continue;
                }

                $res = [];
                $this->filesFlip($res, [], $data);
                $result[$field] += $res;
            }
        }

        return $result;
    }
private function saneFilesArray(array $files)
    {
        $result = [];

        foreach ($files as $field => $data) {
            foreach ($data as $key => $val) {
                $result[$field] = [];
                if (!is_array($val)) {
                    $result[$field] = $data;
                    continue;
                }

                $res = [];
                $this->filesFlip($res, [], $data);
                $result[$field] += $res;
            }
        }

        return $result;
    }
Fixes the $_FILES array structure

For each subtree in the file tree that's more than one item deep:
For each leaf of the subtree:
$leaf[a][b][c] ... [y][z] -> $result[z][a][b][c]  ... [y]


@see: https://stackoverflow.com/a/24397828/1271488

@param array $files
@return array