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

Breadcrumb

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

function File::getTargetFile

3 calls to File::getTargetFile()
File::move in vendor/symfony/http-foundation/File/File.php
Moves the file to a new location.
UploadedFile::move in vendor/symfony/psr-http-message-bridge/Factory/UploadedFile.php
Moves the file to a new location.
UploadedFile::move in vendor/symfony/http-foundation/File/UploadedFile.php
Moves the file to a new location.

File

vendor/symfony/http-foundation/File/File.php, line 115

Class

File
A file in the file system.

Namespace

Symfony\Component\HttpFoundation\File

Code

protected function getTargetFile(string $directory, ?string $name = null) : self {
    if (!is_dir($directory)) {
        if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) {
            throw new FileException(\sprintf('Unable to create the "%s" directory.', $directory));
        }
    }
    elseif (!is_writable($directory)) {
        throw new FileException(\sprintf('Unable to write in the "%s" directory.', $directory));
    }
    $target = rtrim($directory, '/\\') . \DIRECTORY_SEPARATOR . (null === $name ? $this->getBasename() : $this->getName($name));
    return new self($target, false);
}

API Navigation

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