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

Breadcrumb

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

function UploadedFile::__construct

Same name in this branch
  1. 11.1.x vendor/guzzlehttp/psr7/src/UploadedFile.php \GuzzleHttp\Psr7\UploadedFile::__construct()
  2. 11.1.x vendor/symfony/http-foundation/File/UploadedFile.php \Symfony\Component\HttpFoundation\File\UploadedFile::__construct()

Overrides UploadedFile::__construct

File

vendor/symfony/psr-http-message-bridge/Factory/UploadedFile.php, line 26

Class

UploadedFile
@author Nicolas Grekas <p@tchwork.com>

Namespace

Symfony\Bridge\PsrHttpMessage\Factory

Code

public function __construct(UploadedFileInterface $psrUploadedFile, callable $getTemporaryPath) {
    $error = $psrUploadedFile->getError();
    $path = '';
    if (\UPLOAD_ERR_NO_FILE !== $error) {
        $path = $psrUploadedFile->getStream()
            ->getMetadata('uri') ?? '';
        if ($this->test = !\is_string($path) || !is_uploaded_file($path)) {
            $path = $getTemporaryPath();
            $psrUploadedFile->moveTo($path);
        }
    }
    parent::__construct($path, (string) $psrUploadedFile->getClientFilename(), $psrUploadedFile->getClientMediaType(), $psrUploadedFile->getError(), $this->test);
}

API Navigation

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