UNPKG

552 BJavaScriptView Raw
1const assert = require ('assert');
2const UploadAction = require ('./upload-action');
3
4/**
5 * @class ArrayUploadAction
6 *
7 * Action for uploading an array files. The files will be available on req.files
8 * in onUploadComplete(req,res).
9 */
10module.exports = UploadAction.extend ({
11 /// The name of the field that will contain the uploaded files.
12 name: null,
13
14 init () {
15 this._super.call (this, ...arguments);
16
17 assert (!!this.name, "You must define the 'name' property.");
18
19 this._middleware = this._upload.array (this.name);
20 }
21});