The upload form in @indiekit/endpoint-files accepts a single file: the input has no multiple attribute, and formController.post (lib/controllers/form.js) reads request.files.file as one object. Uploading a set of photos for a post means repeating the form once per file.
Nothing in the stack prevents several: express-fileupload returns an array for a repeated file field, and the media endpoint takes one file per request, so the controller only needs to loop. This is the no-JavaScript half of #722 (the form there is a different question, about adding fieldsets to the post form).
Fix: add multiple to the input; in the controller, treat request.files.file as one file or an array, upload each in turn (in turn rather than concurrently, since a Git-backed store may not accept parallel writes, see #792), and report: the media endpoint's own message for one file, “%s files uploaded” for several, “%s of %s files uploaded” when some failed, and the error page only when none succeeded. PR to follow.
The upload form in
@indiekit/endpoint-filesaccepts a single file: the input has nomultipleattribute, andformController.post(lib/controllers/form.js) readsrequest.files.fileas one object. Uploading a set of photos for a post means repeating the form once per file.Nothing in the stack prevents several:
express-fileuploadreturns an array for a repeatedfilefield, and the media endpoint takes one file per request, so the controller only needs to loop. This is the no-JavaScript half of #722 (the form there is a different question, about adding fieldsets to the post form).Fix: add
multipleto the input; in the controller, treatrequest.files.fileas one file or an array, upload each in turn (in turn rather than concurrently, since a Git-backed store may not accept parallel writes, see #792), and report: the media endpoint's own message for one file, “%s files uploaded” for several, “%s of %s files uploaded” when some failed, and the error page only when none succeeded. PR to follow.