1

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.

user779159
  • 9,034
  • 14
  • 59
  • 89

1 Answers1

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'].

Community
  • 1
  • 1
Nocturno
  • 9,579
  • 5
  • 31
  • 39