You are here

private static function ServerRequest::normalizeNestedFileSpec in Lockr 7.3

Normalize an array of file specifications.

Loops through all nested files and returns a normalized array of UploadedFileInterface instances.

Parameters

array $files:

Return value

UploadedFileInterface[]

1 call to ServerRequest::normalizeNestedFileSpec()
ServerRequest::createUploadedFileFromSpec in vendor/guzzlehttp/psr7/src/ServerRequest.php
Create and return an UploadedFile instance from a $_FILES specification.

File

vendor/guzzlehttp/psr7/src/ServerRequest.php, line 138

Class

ServerRequest
Server-side HTTP request

Namespace

GuzzleHttp\Psr7

Code

private static function normalizeNestedFileSpec(array $files = []) {
  $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] = self::createUploadedFileFromSpec($spec);
  }
  return $normalizedFiles;
}