You are here

public function File::move in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/File/File.php \Symfony\Component\HttpFoundation\File\File::move()

Moves the file to a new location.

Parameters

string $directory The destination folder:

string $name The new file name:

Return value

File A File object representing the new file

Throws

FileException if the target file could not be created

1 call to File::move()
UploadedFile::move in vendor/symfony/http-foundation/File/UploadedFile.php
Moves the file to a new location.
1 method overrides File::move()
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 92

Class

File
A file in the file system.

Namespace

Symfony\Component\HttpFoundation\File

Code

public function move($directory, $name = null) {
  $target = $this
    ->getTargetFile($directory, $name);
  if (!@rename($this
    ->getPathname(), $target)) {
    $error = error_get_last();
    throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this
      ->getPathname(), $target, strip_tags($error['message'])));
  }
  @chmod($target, 0666 & ~umask());
  return $target;
}