I am creating a javascript application that is communicating with a REST web server, to add an image I have to convert it to base64. To convert the image to base64 I was going to use canvas toDataUrl() but to load a local file I need to use the File API which is not that well supported (I need to support at least IE9). Is there a way how I can achieve this without using the file API and without using the server?
One solution would be to use the File API when supported and fall back to Flash Player for browsers that don't support the File API.
It pretty easy to convert a ByteArray in Flash into a Base64 string. I usually use com.sociodox.utils.Base64 because the encoding performance is great.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With