I want to upload multiple files with random field name
curl http://localhost:5050/upload \
-X POST \
[email protected] \
[email protected] \
[email protected]
When I don't specify "a", "b" and "c" in upload.fields, I will get "Error: Unexpected field".
Note that the field name is random and the number of fields can not be determined. So it is impossible to define field name in upload.fields.
Do I have to specify field name? How can I solve this problem?
You can use .any(), be sure to handle all the files though :)
Works like a charm! Thank you!
I had the exact same problem using multer to parse incoming emails with attachments. using .any solved the problem. Thank you.
In case you just copied that curl command and wonder why it doesn't work — it's missing -F switch.
Most helpful comment
You can use
.any(), be sure to handle all the files though :)https://github.com/expressjs/multer#any