Okay, basically I've developed a simple image upload system. The user selects a local image (using the HTML5 File / FileReader API) and has the ability to crop it before confirming the result.
The final result is viewed in a canvas so to send it to the server I'm using toDataURL. The backend server is a NodeJS server which then needs to make a REST call to a Java server which will create an image file from the data and save it to disk.
The results of toDataURL are in the form: data:image/png;base64, ENCODED DATA.
What would I need on the Java server to convert the string into it's proper binary representation?
解决方案
You need to remove the data:image/png;base64, part and base 64 decode the rest.