Skip to content

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

@marsdk

Description

@marsdk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions