I have a base64 encoded string which is posted using JSON into a Spring form.
data:image/png;base64,iVBORw0KGg......etc
I want to add this
i encounter the same issue and I was able to fix it using this code:
//you have to parse the data first to remove "data:image/png;base64" before you can use the decodeBase64(data).
byte[] imgBytes = Base64.decodeBase64(data);
ByteArrayDataSource dSource = new ByteArrayDataSource(imgBytes, "image/*");