public function UploadedFile::move

Moves the file to a new location.

@api

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 file has not been uploaded via Http

Overrides File::move

File

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

Class

UploadedFile
A file uploaded through a form.

Namespace

Symfony\Component\HttpFoundation\File

Code

public function move($directory, $name = null) {
  if ($this
    ->isValid() && ($this->test || is_uploaded_file($this
    ->getPathname()))) {
    return parent::move($directory, $name);
  }
  throw new FileException(sprintf('The file "%s" has not been uploaded via Http', $this
    ->getPathname()));
}