function ServerRequestCreator::normalizeNestedFileSpec
Normalize an array of file specifications.
Loops through all nested files and returns a normalized array of UploadedFileInterface instances.
Return value
1 call to ServerRequestCreator::normalizeNestedFileSpec()
- ServerRequestCreator::createUploadedFileFromSpec in vendor/
nyholm/ psr7-server/ src/ ServerRequestCreator.php - Create and return an UploadedFile instance from a $_FILES specification.
File
-
vendor/
nyholm/ psr7-server/ src/ ServerRequestCreator.php, line 242
Class
- ServerRequestCreator
- @author Tobias Nyholm <tobias.nyholm@gmail.com> @author Martijn van der Ven <martijn@vanderven.se>
Namespace
Nyholm\Psr7ServerCode
private function normalizeNestedFileSpec(array $files = []) : array {
$normalizedFiles = [];
foreach (\array_keys($files['tmp_name']) as $key) {
$spec = [
'tmp_name' => $files['tmp_name'][$key],
'size' => $files['size'][$key],
'error' => $files['error'][$key],
'name' => $files['name'][$key],
'type' => $files['type'][$key],
];
$normalizedFiles[$key] = $this->createUploadedFileFromSpec($spec);
}
return $normalizedFiles;
}