If you POST an HTML form with an enctype attribute (for example enctype=multipart/form-data) and it gets submitted to an Express Route, how can you access that enctype value from the route or from middleware? I'm on Express 4.x.
Asked
Active
Viewed 1,373 times
1
-
1I think it should be in headers so check req.headers – Molda Nov 13 '15 at 07:30
1 Answers
1
When you set the enctype
attribute on a form, the browser sends it as content-type
in the request (see this SO question for more details). In Express, you can access the content-type
header name from the request object like this: req.headers['content-type']
.