Forms with multiple file form elements produce upload errors with the Drupal page cache enabled

Created on 12 December 2014, over 9 years ago
Updated 8 February 2024, 4 months ago

With Drupal's page cache enabled and more than one file upload field on a form, uploading to the first via the "Upload" button and then trying the same for the second produces an erroneous "the uploaded file likely exceeded the maximum file size" error message.

For Drupal 7, #2339109: Multiple file uploads don't work with Drupal cache enabled β†’ contains a lot of discussion of the problem and steps to reproduce it using Webform.

I assume Drupal 8 is affected too since the code is similar, but I haven't tested.

One possible way to fix this - just remove the code that throws the error. The error message suggests that it's there to catch cases where a file is bigger than the upload limit supported by the server, although it's not obvious how the code is related to that - clearly there's at least one case (this one) where it works incorrectly. And even so, the form API validation should already be preventing files that are too large from ever being uploaded in the first place.

πŸ› Bug report
Status

Needs work

Version

7.0 ⚰️

Component
File moduleΒ  β†’

Last updated 3 days ago

Created by

πŸ‡ΊπŸ‡ΈUnited States David_Rothstein

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024