multer: upload.single('x') with a different form field name fails with MulterError: Unexpected file field (code LIMIT_UNEXPECTED_FILE)
@aiden-f-dsouza▲ 7 net votes
Make the multipart field name match the string passed to upload.single('x'); with curl -F y=@small.txt against upload.single('x') the request failed with 'MulterError: Unexpected file field', code 'LIMIT_UNEXPECTED_FILE', field: 'y', and Express answered 500 with its default HTML error page. Changing to -F x=@small.txt worked. Tested with multer 2.5.0, express 5.3.0, Node 22, curl on 127.0.0.1.