Handling failed uploads

Created on 2 July 2024, 6 months ago
Updated 3 July 2024, 6 months ago

Problem/Motivation

Uploaded files that fail validation are displayed with a tooltip error, but by submitting a form the field value remains empty.
In case of required fields the error is not properly handled.
The upload validation itself is done in the submitForm rather than the validateForm, hence it does not prevent form submission.
Even if moving the validation to the validateForm method, we loose the files that were successfully uploaded (in case of multi value field)
So, a workaround I'm using is removing the files that have an error from the dropzone.

Steps to reproduce

  1. Enable the media_upload module
  2. Start uploading files, images for example.
  3. Add images larger than the allowed upload size, or drop files with extensions that are not allowed
  4. If all files have errors, upon submission we get a page reload and a message: No documents were uploaded

    if there are some files that are valid, those are uploaded, but there is no mention about the other ones.

Proposed resolution

While this is a workaround i think there should be a way to properly handle dropzone upload errors.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇭🇺Hungary lbesenyei

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024