diff options
author | Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org> | 2006-03-16 15:27:45 +0000 |
---|---|---|
committer | Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org> | 2006-03-16 15:27:45 +0000 |
commit | 0de876d095a4bd1b05e39e133b55d8f312469194 (patch) | |
tree | 89de53bad5332b5fa253f63b932da5165e4fbb90 /modules/upload | |
parent | 9841e29a13777d39a28f70c5a8e959b7cef53d88 (diff) | |
download | brdo-0de876d095a4bd1b05e39e133b55d8f312469194.tar.gz brdo-0de876d095a4bd1b05e39e133b55d8f312469194.tar.bz2 |
#54186, Uploads still listed on upload form after validation errors, patch by timcn
Diffstat (limited to 'modules/upload')
-rw-r--r-- | modules/upload/upload.module | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/upload/upload.module b/modules/upload/upload.module index 893c2d7ff..5c50bc8a1 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -263,6 +263,7 @@ function _upload_validate(&$node) { // Only denies an upload when all roles prevent it. $total_usersize = upload_space_used($user->uid) + $filesize; + $error = array(); foreach ($user->roles as $rid => $name) { $extensions = variable_get("upload_extensions_$rid", 'jpg jpeg gif png txt html doc xls pdf ppt pps'); $uploadsize = variable_get("upload_uploadsize_$rid", 1) * 1024 * 1024; @@ -291,6 +292,10 @@ function _upload_validate(&$node) { elseif ($error['usersize'] == count($user->roles) && $user->uid != 1) { form_set_error('upload', t('The selected file %name can not be attached to this post, because the disk quota of %quota has been reached.', array('%name' => theme('placeholder', $file->filename), '%quota' => theme('placeholder', format_size($usersize))))); } + if (count($error)) { + unset($node->files[$fid], $_SESSION['file_previews'][$fid]); + file_delete($file->filepath); + } } } } |