Base64 image upload VS Binary image upload? Base64 image upload VS Binary image upload? android android

Base64 image upload VS Binary image upload?


Base64 converts your data to an ASCII representation of the binary data. It allows you to embed your data in text streams such as JSON for example. Base64 increases the size of the data transferred by 33%.

multipart/form-data is the standard way of transferring binary data in HTTP requests. It allows you to use specific encodings / content types for each part you'd like to transfer. In my opinion, you should stick to multipart uploads unless you have specific requirements or device/SDK capabilities.


'Why not just use binary upload with multipart headers on the http request?' indeed why not ;)

Base64 image representation can be directly placed within html to render an image.

Binary takes up less space. And benefits from greater network effects and standardization. E.g. if you want to use amazon simple secure storage S3 you have to store a binary file. You can't store a string you would need a key/value store e.g. redis.