Moves the file to a new location.
@api
string $directory The destination folder:
string $name The new file name:
File A File object representing the new file
FileException if the target file could not be created
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;
}