The code for file_destination() is
function file_destination($destination, $replace) {
if (file_exists($destination)) {
switch ($replace) {
case FILE_EXISTS_RENAME:
$basename = basename($destination);
$directory = dirname($destination);
$destination = file_create_filename($basename, $directory);
break;
case FILE_EXISTS_ERROR:
drupal_set_message(t('The selected file %file could not be copied, because a file by that name already exists in the destination.', array('%file' => $source)), 'error');
return FALSE;
}
}
return $destination;
}
however, $source is not previously declared, $destination should be used.
Comments
Comment #1
chx commentedComment #2
gábor hojtsyThanks, committed.
Comment #3
(not verified) commented