Add multiple file uploading
This is an attempt to provide multiple file upload per issue #174.
- The "Add a document" button becomes "Add documents".
- If the user selects only one file in the file chooser, behavior is unchanged.
- If the user shift-clicks or control/command-clicks to select multiple files in the file chooser, each is uploaded.
- If the user doesn't provide a name or description, behavior for each file is unchanged: the source filename is used and the description is blank.
- If the user provides a name and selects multiple files, the provided name + a bates number is used as the document name (e.g., if name = "alpha" and multiple files are selected, this would result in alpha_00001, alpha_00002, alpha_00003, ... in the documents list).
- This is an arbitrary choice, but could be a useful feature to batch rename/anonymize the document names.
- If the user provides a description and selects multiple files, each uploaded file will use the same description.
- I've updated the localizations, but I'm not a fluent speaker of the other languages, so those should be checked.
This solution makes use of the multiple
attribute of the <input type='file' multiple />
element, then iterates over the 1 or more selected files uploading each via a separate XMLHttpRequest, keeping count of how may requests were made and only removing the spinner once every xhr request has either succeeded or errored.
Edited by William Doane