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

Breadcrumb

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

function UploadedFile::move

Same name in this branch
  1. 11.1.x vendor/symfony/http-foundation/File/UploadedFile.php \Symfony\Component\HttpFoundation\File\UploadedFile::move()

Overrides UploadedFile::move

File

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

Class

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

Namespace

Symfony\Bridge\PsrHttpMessage\Factory

Code

public function move(string $directory, ?string $name = null) : File {
    if (!$this->isValid() || $this->test) {
        return parent::move($directory, $name);
    }
    $target = $this->getTargetFile($directory, $name);
    try {
        $this->psrUploadedFile
            ->moveTo((string) $target);
    } catch (\RuntimeException $e) {
        throw new FileException(\sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, $e->getMessage()), 0, $e);
    }
    @chmod($target, 0666 & ~umask());
    return $target;
}

API Navigation

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