25

Can any one explain what is the advantage of Base64 as well Multipart

I know Multipart is faster then Base64...

But still many developers are using Base64...I studied both documentation but i am not clear

demo
  • 672
  • 3
  • 9
  • 34

2 Answers2

45

Base64
Base64 is a way to encode binary data into an ASCII character format by translating it into a radix-64 representation.
I recommend you that never use Base64 for large file/data upload to server beacuse it's convert whole data and post it to server.

Multipart
Multipart is a way to upload file/data to server in the form of part which are in bytes. Multpart/form-data is applied to a form though, so you can send everything in a multi-part form, including "regular" data also.

Maraj Hussain
  • 1,580
  • 10
  • 26
  • 1
    @Mariyappan your welcome, If you find this answered is good enough for you then don't forgot to accept it. :) – Maraj Hussain Nov 03 '17 at 12:40
  • It is worth noting though that in most (all?) cases, binary multipart/form-data data is encoded as base64. – Matthew Feb 20 '20 at 20:51
  • 1
    What do you mean with "large file/data" ? > 5mo ? > 10mo ? > 500mo ? – PierreD Jun 18 '20 at 10:12
  • @PierreD large is relative to year, to internet speed of client, etc. Multipart is there to split file into multiple parts and send them part by part, so that you can show progress, and each part is independently handled. So let's say 5mb to 10mb is large enough for an image if you're not showing any progression on a slow network. – KeitelDOG Jan 27 '23 at 21:12
7

Multipart ist a part of the http protocol. See

https://stackoverflow.com/a/19712083/5694629

Base64 is a way to convert arbitrary content into a serializable form for transmission.

pat_b13
  • 151
  • 8
  • can you tell me sir what is serializable,why we have to use.@pat_b13 – demo Nov 03 '17 at 12:14
  • 2
    Serialization is used to transmit data from one component to another (e.g. from your server to your smartphone). It's done in a form that both components can understand, mostly with the ASCII format, as this is common since long time. Base64 will transform your data into a stream of ASCII characters which can be read by almost any computer component. – pat_b13 Nov 03 '17 at 12:19
  • thank you sir..i am sry to disdrap you sir....i think Deserialization means (mobile to server data transfer or what sir...can you tell me please.... – demo Nov 03 '17 at 12:24
  • 2
    Deserialization is the opposite of serialization. The sender component serializes the data to transmit and the recipient DEserializes the stream of data. The whole process is called 'Serialization'. As ASCII is a common character encoding, it's used for serialization. Base64 contains only ASCII, so it's used to switch your data into a form that can be easily serialized and deserialized. – pat_b13 Nov 03 '17 at 12:36