You are here

private static function ServerRequestFactory::createUploadedFileFromSpec in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php \Zend\Diactoros\ServerRequestFactory::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

array|UploadedFileInterface

2 calls to ServerRequestFactory::createUploadedFileFromSpec()
ServerRequestFactory::normalizeFiles in vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php
Normalize uploaded files
ServerRequestFactory::normalizeNestedFileSpec in vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php
Normalize an array of file specifications.

File

vendor/zendframework/zend-diactoros/src/ServerRequestFactory.php, line 419

Class

ServerRequestFactory
Class for marshaling a request object from the current PHP environment.

Namespace

Zend\Diactoros

Code

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