? .cache ? .project ? .projectOptions ? files ? test.patch ? includes/image.imagemagick.inc ? misc/Thumbs.db ? misc/farbtastic/Thumbs.db ? sites/all/modules ? sites/default/settings.php Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.104 diff -u -p -u -p -r1.104 file.inc --- includes/file.inc 25 Jul 2007 17:41:27 -0000 1.104 +++ includes/file.inc 5 Sep 2007 18:06:40 -0000 @@ -491,14 +491,11 @@ function file_save_upload($source, $vali } // If a file was uploaded, process it. - if (isset($_FILES['files']) && $_FILES['files']['name'][$source] && is_uploaded_file($_FILES['files']['tmp_name'][$source])) { - // Check for file upload errors and return FALSE if a - // lower level system error occurred. + if (isset($_FILES['files']) && $_FILES['files']['name'][$source]) { + // Check for file upload errors and return FALSE if a lower level system + // error occurred. switch ($_FILES['files']['error'][$source]) { // @see http://php.net/manual/en/features.file-upload.errors.php - case UPLOAD_ERR_OK: - break; - case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: drupal_set_message(t('The file %file could not be saved, because it exceeds %maxsize, the maximum allowed size for uploads.', array('%file' => $source, '%maxsize' => format_size(file_upload_max_size()))), 'error'); @@ -509,7 +506,14 @@ function file_save_upload($source, $vali drupal_set_message(t('The file %file could not be saved, because the upload did not complete.', array('%file' => $source)), 'error'); return 0; - // Unknown error + case UPLOAD_ERR_OK: + // Final check that this is a valid upload, if isn't fall through to + // the default error handler. + if (is_uploaded_file($_FILES['files']['tmp_name'][$source])) { + break; + } + + // Unknown error. default: drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.', array('%file' => $source)), 'error'); return 0; @@ -966,8 +970,7 @@ function file_upload_max_size() { if ($max_size < 0) { $upload_max = parse_size(ini_get('upload_max_filesize')); - // sanity check- a single upload should not be more than 50% the size limit of the total post - $post_max = parse_size(ini_get('post_max_size')) / 2; + $post_max = parse_size(ini_get('post_max_size')); $max_size = ($upload_max < $post_max) ? $upload_max : $post_max; } return $max_size;