Add to Favorites

what is base64

You may have seen a string such as "YXNkZmZkc2FhYWFhZGRkZWY=" before. Some of you will recognize this as base64. Base64 is an encoding format used to represent binary data as text. It is commonly used in MIME email formats for things such as attachments.

In php, base64 funcitons are readily available for use.

base64_encode($data) - encodes to base64

base64_decode($data) - decodes from base64

Typically base64 encoded data takes a third more space to store than the original, as the data is encoded to a string versus just being stored as binary. If you are sending email attachments from your app, you will need to base64 encode the attachment as text and format the email accordingly.

Comments

Be the first to leave a comment on this post.

Leave a comment

To leave a comment, please log in / sign up