summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/file.inc13
1 files changed, 8 insertions, 5 deletions
diff --git a/includes/file.inc b/includes/file.inc
index bb9a6a594..6cf3586df 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -445,19 +445,22 @@ function file_copy($source, $destination = NULL, $replace = FILE_EXISTS_RENAME)
* @see file_copy()
*/
function file_unmanaged_copy($source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
+ $original_source = $source;
+ $original_destination = $destination;
+
$source = realpath($source);
if (!file_exists($source)) {
- drupal_set_message(t('The specified file %file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.', array('%file' => $source)), 'error');
+ drupal_set_message(t('The specified file %file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.', array('%file' => $original_source)), 'error');
return FALSE;
}
- $destination = file_create_path($destination);
- $directory = $destination;
+ $proposed_destination = file_create_path($destination);
+ $directory = $proposed_destination;
$basename = file_check_path($directory);
// Make sure we at least have a valid directory.
if ($basename === FALSE) {
- drupal_set_message(t('The specified file %file could not be copied, because the destination %directory is not properly configured.', array('%file' => $source, '%directory' => $destination)), 'error');
+ drupal_set_message(t('The specified file %file could not be copied, because the destination %directory is not properly configured. This is often caused by a problem with file or directory permissions.', array('%file' => $original_source, '%directory' => empty($original_destination) ? $proposed_destination : $original_destination)), 'error');
return FALSE;
}
@@ -467,7 +470,7 @@ function file_unmanaged_copy($source, $destination = NULL, $replace = FILE_EXIST
$destination = file_destination($directory . '/' . $basename, $replace);
if ($destination === FALSE) {
- drupal_set_message(t('The specified file %file could not be copied because a file by that name already exists in the destination.', array('%file' => $source)), 'error');
+ drupal_set_message(t('The specified file %file could not be copied because a file by that name already exists in the destination %directory.', array('%file' => $source, '%directory' => $proposed_destination)), 'error');
return FALSE;
}
// Make sure source and destination filenames are not the same, makes no