function File::move
Moves the file to a new location.
Throws
FileException if the target file could not be created
2 calls to File::move()
- UploadedFile::move in vendor/
symfony/ http-foundation/ File/ 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.
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 85
Class
- File
- A file in the file system.
Namespace
Symfony\Component\HttpFoundation\FileCode
public function move(string $directory, ?string $name = null) : self {
$target = $this->getTargetFile($directory, $name);
set_error_handler(function ($type, $msg) use (&$error) {
$error = $msg;
});
try {
$renamed = rename($this->getPathname(), $target);
} finally {
restore_error_handler();
}
if (!$renamed) {
throw new FileException(\sprintf('Could not move the file "%s" to "%s" (%s).', $this->getPathname(), $target, strip_tags($error)));
}
@chmod($target, 0666 & ~umask());
return $target;
}