Base64 error: The image contents is not valid base64 data java
I’m streaming an image to Magento and encoding the image using
android.util.Base64 in any of the following ways:
Base64.encodeToString(content, Base64.CRLF) Base64.encodeToString(content, Base64.DEFAULT)
But I always get the error :
The image contents is not valid base64 data
Working: I found that the data had to be encoded twice, one time using
Base64 and another encoding using custom Library
Try to remove the data node from the base64 code of the image.
For example, if you have something like
data:image/png; base64,iVBORw0KGgoAAAANSUhEUgAAAVQAAABXCAYAA... Such data
Then delete the data node. It should look like the following and pass it to Magento.