[EMB-60] Prevent user from selecting multiple files when clicking upload button. #341
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Currently for quickfiles, uploading multiple files by drag'n'drop is not allowed and would show "Cannot upload multiple files". However, this is not the case when user clicks the "upload" button and select multiple files to upload. This PR fix this problem by not allowing users to select multiple files for upload.
Summary of Changes
Dropzone.js handles drag'n'drop upload differently than clicking the "upload" button for upload. Therefore, there is not an event handler that we can override to prevent multiple uploads through clicking the "upload" button. However, we could remove the "multiple" attribute from the hidden
<input>element Dropzone uses, thus preventing users from selecting multiple files. And that is what is done in this PR.Side Effects / Testing Notes
None.
Ticket
https://openscience.atlassian.net/browse/EMB-60
Reviewer Checklist
CHANGELOG.md