What is http multipart request?

Http HeadersMultipart

Http Headers Problem Overview


I have been writing iPhone applications for some time now, sending data to server, receiving data (via HTTP protocol), without thinking too much about it. Mostly I am theoretically familiar with process, but the part I am not so familiar is HTTP multipart request. I know its basic structure, but the core of it eludes me.

It seems that whenever I am sending something different than plain text (like photos, music), I have to use a multipart request. Can someone briefly explain to me why it is used and what are its advantages?

If I use it, why is it better way to send photos that way?

Http Headers Solutions


Solution 1 - Http Headers

An HTTP multipart request is an HTTP request that HTTP clients construct to send files and data over to an HTTP Server. It is commonly used by browsers and HTTP clients to upload files to the server.

Solution 2 - Http Headers

As the official specification says, "one or more different sets of data are combined in a single body". So when photos and music are handled as multipart messages as mentioned in the question, probably there is some plain text metadata associated as well, thus making the request containing different types of data (binary, text), which implies the usage of multipart.

Solution 3 - Http Headers

I have found an excellent and relatively short explanation here.

> A multipart request is a REST request containing several packed REST requests inside its entity.

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
QuestionMegaManXView Question on Stackoverflow
Solution 1 - Http HeadersIggyView Answer on Stackoverflow
Solution 2 - Http HeaderscsontiView Answer on Stackoverflow
Solution 3 - Http HeadersJakovView Answer on Stackoverflow