// The destination is already a directory, so append the source basename.
$destination =
$this->streamWrapperManager->
normalizeUri($destination . '/' .
$this->
basename($source));
} else { // Perhaps $destination is a dir/file?
$dirname =
$this->
dirname($destination);
if (!
$this->
prepareDirectory($dirname)) { $this->logger->
error("The specified file '%original_source' could not be copied because the destination directory '%destination_directory' is not properly configured. This may be caused by a problem with file or directory permissions.",
[ '%original_source' =>
$original_source,
'%destination_directory' =>
$dirname,
]);
throw new DirectoryNotReadyException("The specified file '
$original_source' could not be copied because the destination directory '
$dirname' is not properly configured. This may be caused by a problem with file or directory permissions."
);
} } // Determine whether we can perform this operation based on overwrite rules.
$destination =
$this->
getDestinationFilename($destination,
$replace);
if ($destination === FALSE
) { $this->logger->
error("File '%original_source' could not be copied because a file by that name already exists in the destination directory ('%destination').",
[ '%original_source' =>
$original_source,
'%destination' =>
$destination,
]);
throw new FileExistsException("File '
$original_source' could not be copied because a file by that name already exists in the destination directory ('
$destination')."
);
}