How to send multipart/form-data request using Postman

Multipartform Data

Multipartform Data Problem Overview


I am currently using the Chrome Addon Postman - REST Client to easily create POST / GET request.

Now I want to debug an upload script and I am looking for a way to make requests encoded as "multipart/form-data" so that I can send also a file.

Multipartform Data Solutions


Solution 1 - Multipartform Data

UPDATE: I have created a video on sending multipart/form-data requests to explain this better.


Actually, Postman can do this.

enter image description here

Full example:

enter image description here

You DON'T need to add any headers, Postman will do this for you automatically.

enter image description here

Make sure you check the comment from @maxkoryukov

> Be careful with explicit Content-Type header. Better - do not set it's > value, the Postman is smart enough to fill this header for you. BUT, > if you want to set the Content-Type: multipart/form-data - do not > forget about boundary field.

Solution 2 - Multipartform Data

The usual error is one tries to put Content-Type: {multipart/form-data} into the header of the post request. That will fail, it is best to let Postman do it for you. For example:

Suggestion To Load Via Postman Body Part

Fails If In Header Common Error

Works should remove content type from the Header

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionValentin DespaView Question on Stackoverflow
Solution 1 - Multipartform DataValentin DespaView Answer on Stackoverflow
Solution 2 - Multipartform DataHung VuView Answer on Stackoverflow