Upload file on Express.js app Upload file on Express.js app express express

Upload file on Express.js app


If you are using Postman, you can try removing the Header: "Content-type": "multipart/form-data". I removed it and now it works.


Boundary in a multipart form indicates some delimiter string separating text and binary data. You can do this in postman but it sounds like you aren't sending both file and text so postman maybe defaults to a regular form. do you see something like:

postman-form-multipart

If you click preview in postman you can see the boundary in the Content-type header and in the body.


solutions:

1) don't specify the content-type at client

2) use the naming convention(imageUpload) in upload.single('imageUpload') same as field name