Why or when should someone use Multipart/form-data
?
the thing is I use to upload images to server with httpost base64
(random example) but I noticed while reading through volley
I Can upload file with multipart/form-data ..
So when should I use consider to upload my images to server ? multipart
or httpost base64
Base64-encoded data is approximately 33% larger, meaning longer upload times, more bandwidth used, and a lower maximum file size for non-multipart uploads. You can insert or update blob data using a non-multipart message, but you are limited to 50 MB of text data or 37.5 MB of base64–encoded data.
It is worth noting though that in most (all?) cases, binary multipart/form-data data is encoded as base64.
use multipart/form-data when your form includes any <input type="file"> elements. otherwise you can use multipart/form-data or application/x-www-form-urlencoded but application/x-www-form-urlencoded will be more efficient.
Base64 encoding schemes are commonly used when there is a need to encode binary data that needs to be stored and transferred over media that are designed to deal with ASCII. This is to ensure that the data remain intact without modification during transport.
Multipart is multi part (duh).
So if you have a very large file the request will send it in multiple parts instead of inside a "regular" POST request. Since POST requests also have an upper limit, which now I don't remember but its not that much (a couple of megabytes) if you upload something huge you should use multipart-forms if you use http.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With