Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ServerRequest.php

function ServerRequest::normalizeNestedFileSpec

Normalize an array of file specifications.

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

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 140

Class

ServerRequest
Server-side HTTP request

Namespace

GuzzleHttp\Psr7

Code

private static 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] ?? null,
            'error' => $files['error'][$key] ?? null,
            'name' => $files['name'][$key] ?? null,
            'type' => $files['type'][$key] ?? null,
        ];
        $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec);
    }
    return $normalizedFiles;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal