Coder_sLaY Coder_sLaY - 1 year ago 176
Javascript Question

How to convert image into base64 string using javascript

I need to convert my image to a base64 string so that i can send my image to a server.
Is there any js file for this... ? Else how to convert it

Answer Source

You can use the HTML5 <canvas> for it:

Create a canvas, load your image into it and then use toDataURL() to get the base64 representation (actually, it's a data: URL but it contains the base64-encoded image).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download