multer - req.file always undefined
In case of postman, try following:
- Close the postman tab for the API
- Open a new tab again
- Rebuild the API request and then send.
This may fix the problem. Every time you restart the server you need to do above steps for calling the API again. The reason being multer sends back some cookies called connect.sid to the client which it may require in further communication. Using old cookies will not upload the file.
Your enctype
is slightly incorrect, it should be multipart/form-data
instead of multipart/formdata
.