error details when the file copy fails

This commit is contained in:
Shish 2011-11-08 11:02:04 +00:00
parent 054a92a979
commit a89c5943d8

View file

@ -972,7 +972,8 @@ function move_upload_to_archive($event) {
$target = warehouse_path("images", $event->hash);
if(!file_exists(dirname($target))) mkdir(dirname($target), 0755, true);
if(!@copy($event->tmpname, $target)) {
throw new UploadException("Failed to copy file from uploads ({$event->tmpname}) to archive ($target)");
$errors = error_get_last(); // note: requires php 5.2
throw new UploadException("Failed to copy file from uploads ({$event->tmpname}) to archive ($target): {$errors['type']} / {$errors['message']}");
return false;
}
return true;