pressflow / 6

Each version of Pressflow is API-compatible with the same major Drupal version. For example, Pressflow 6 is compatible with all Drupal 6 modules. Pressflow 6 also integrates the SimpleTest system from Drupal 7 and the CDN support patch.
http://pressflow.org/
GNU General Public License v2.0
235 stars 90 forks source link

file_save_upload() is not notifying user when PHP upload limit is exceeded. #99

Open marsdk opened 9 years ago

marsdk commented 9 years ago

In includes/file.inc line 517 the following code takes care of handling the errors if something has occurred during file upload.

if (isset($_FILES['files']) && $_FILES['files']['name'][$source] && is_uploaded_file($_FILES['files']['tmp_name'][$source])) {

The issue is that if the PHP upload limit is reached the is_uploaded_file() function will return false and the error will never be returned correct to the user. The user gets an error, but just an message that the image could not be uploaded - not the "file is too large"-error. The is_uploaded_file() function should not be in this if-statement.

Perhaps $_FILES['files']['error'][$source] should be checked first as testing show that it gives a proper 1 as a result.

There are multiple patches for this, but it has never gotten into the master branch for drupalistic reasons. https://www.drupal.org/node/30520