Using Dropzone in the frontend to upload multiple files to the server in one request and using the Multer middleware to handle multipart/form-data. Set uploadMultiple: true
in the Dropzone config, it will append [] to the name. For example, the name would be files[0], files1 etc.
The server side codes:
var uploader = multer({dest: dest});
router.post(url, uploader.array('files', 30), function(req, res) {
...
});
However, seems multer().array(fieldname) only allows the fieldname matches the name in the form data. Otherwise, it throws LIMIT_UNEXPECTED_FILE error.
Any suggestions to fix it by making the name always as 'fields' instead of appending [] or making the multer to handle different names like that?