protected function File::getTargetFile

2 calls to File::getTargetFile()
File::move in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php
Moves the file to a new location.
UploadedFile::move in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php
Moves the file to a new location.

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php, line 130

Class

File
A file in the file system.

Namespace

Symfony\Component\HttpFoundation\File

Code

protected function getTargetFile($directory, $name = null) {
  if (!is_dir($directory)) {
    if (false === @mkdir($directory, 0777, true)) {
      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 = $directory . DIRECTORY_SEPARATOR . (null === $name ? $this
    ->getBasename() : $this
    ->getName($name));
  return new File($target, false);
}