Search code examples
node.jsexpresspostmanform-data

Form-data requests with Postman


How can I send a Postman request using form-data? If I try to use raw format works, but I need the form-data to send a image.

Here is my Postman request: Postman screenshot

And my API API screenshot

My server.js file has the following middlewares:

// Add middleware/settings/routes to express.
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({extended: true}));
app.use('/api', BaseRouter);
app.disable('etag');

Solution

  • Have you implemented the middleware to decode the binary file in Body at BE side?

    If you're using ExpressJS. You can use the Lib multer

    https://github.com/expressjs/multer