function ServerRequest::normalizeFiles
Return an UploadedFile instance array.
Parameters
array $files An array which respect $_FILES structure:
Throws
InvalidArgumentException for unrecognized values
1 call to ServerRequest::normalizeFiles()
- ServerRequest::fromGlobals in vendor/
guzzlehttp/ psr7/ src/ ServerRequest.php - Return a ServerRequest populated with superglobals: $_GET $_POST $_COOKIE $_FILES $_SERVER
File
-
vendor/
guzzlehttp/ psr7/ src/ ServerRequest.php, line 87
Class
- ServerRequest
- Server-side HTTP request
Namespace
GuzzleHttp\Psr7Code
public static function normalizeFiles(array $files) : array {
$normalized = [];
foreach ($files as $key => $value) {
if ($value instanceof UploadedFileInterface) {
$normalized[$key] = $value;
}
elseif (is_array($value) && isset($value['tmp_name'])) {
$normalized[$key] = self::createUploadedFileFromSpec($value);
}
elseif (is_array($value)) {
$normalized[$key] = self::normalizeFiles($value);
continue;
}
else {
throw new InvalidArgumentException('Invalid value in files specification');
}
}
return $normalized;
}