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

Breadcrumb

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

function ServerRequestCreator::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 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\Psr7Server

Code

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;
}

API Navigation

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