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

Breadcrumb

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

function ServerRequest::createUploadedFileFromSpec

Create and return an UploadedFile instance from a $_FILES specification.

If the specification represents an array of values, this method will delegate to normalizeNestedFileSpec() and return that return value.

Parameters

array $value $_FILES struct:

Return value

UploadedFileInterface|UploadedFileInterface[]

2 calls to ServerRequest::createUploadedFileFromSpec()
ServerRequest::normalizeFiles in vendor/guzzlehttp/psr7/src/ServerRequest.php
Return an UploadedFile instance array.
ServerRequest::normalizeNestedFileSpec in vendor/guzzlehttp/psr7/src/ServerRequest.php
Normalize an array of file specifications.

File

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

Class

ServerRequest
Server-side HTTP request

Namespace

GuzzleHttp\Psr7

Code

private static function createUploadedFileFromSpec(array $value) {
    if (is_array($value['tmp_name'])) {
        return self::normalizeNestedFileSpec($value);
    }
    return new UploadedFile($value['tmp_name'], (int) $value['size'], (int) $value['error'], $value['name'], $value['type']);
}

API Navigation

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