javascriptnode.jsexpresspostman

How to receive file from Postman or Next.js with POST method


I want to send a file as image or pdf. While I am using Postman, I make POST method and body type is form-data. Liike this screenshot:

enter image description here. But I can't receive any body in Express. My Node.js code is like:

enter image description here

And output is like that:

enter image description here

I tried multer and multipart libraries, but it doesn't work. How can I solve this problem?


Solution

  • Have you by any chance tried using Body-Parser? It could resolve an issue you may have, if that still does not work. You could try looking at Multer Docs, I hope this helps!