Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By NewToDruballer on
I think, there is a bug in includes/file.inc. Sorry, I post it here, but I did not find a Bugtracker for Drupal-Core:
Starting in line 196:
if ($_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.
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 the maximum allowed size for uploads.', array('%file' => $source)), 'error');
return 0;
case UPLOAD_ERR_PARTIAL:
case UPLOAD_ERR_NO_FILE:
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
default:
drupal_set_message(t('The file %file could not be saved. An unknown error has occurred.', array('%file' => $source)),'error');
return 0;
}
The if-clause checks, if there was a file uploaded. If no file was uploaded, then it ommits the following switch-case-block.
But if a file was not uploaded because of a to big filesize, is_uploaded_file() will also return false, as if there was no trying to upload.
That means, that there will be no errormessage.
Solution would be to remove " && is_uploaded_file($_FILES["files"]["tmp_name"][$source])" from the if-part.
Markus
Comments
...
Please open an issue.
Click 'issues', then 'create', and in 'Project' choose 'Drupal'.