Skip to content

Show error message if too many files are selected for upload#2376

Merged
bemoody merged 2 commits intodevfrom
bm/too-many-files-warning
Apr 4, 2025
Merged

Show error message if too many files are selected for upload#2376
bemoody merged 2 commits intodevfrom
bm/too-many-files-warning

Conversation

@bemoody
Copy link
Collaborator

@bemoody bemoody commented Apr 4, 2025

Django's (default) file upload mechanism is limited in the number of files it can handle (independent of limitations on file size.)

Consequently, Django enforces a hard limit on the number of files and raises an exception if this is exceeded. (Pull #2036 made this limit configurable.)

Note that HTML doesn't allow specifying any limit for multiple-file upload fields.

Try to prevent people hitting the limit by accident, by disabling the submit button through JavaScript if too many files are selected.

For thoughts about better long-term solutions, see issue #2242.

Benjamin Moody added 2 commits April 4, 2025 15:43
…ded.

The file upload form is limited in the number of files it can handle
due to design limitations of the Django upload handler.  Exceeding the
limit set by DATA_UPLOAD_MAX_NUMBER_FILES will currently cause the
page to crash (and doesn't give a useful error message.)

Display a message to advise authors of this limitation.
The file upload form is limited in the number of files it can handle
due to design limitations of the Django upload handler.  Exceeding the
limit set by DATA_UPLOAD_MAX_NUMBER_FILES will currently cause the
page to crash (and doesn't give a useful error message.)

To prevent this happening accidentally, disable the submit button and
show an error message if too many files are selected.
Copy link
Member

@tompollard tompollard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me

@bemoody bemoody added this pull request to the merge queue Apr 4, 2025
Merged via the queue into dev with commit d760271 Apr 4, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants