I have a PHP script that can encode a PNG image to a Base64 string.
I\'d like to do the same thing using JavaScript. I know how to open files, but I\'m not sure how
You can use btoa (to base-64) and atob (from base-64).
btoa
atob
For IE 9 and below, try the jquery-base64 plugin:
$.base64.encode("this is a test"); $.base64.decode("dGhpcyBpcyBhIHRlc3Q=");