I have a website where user upload image, using JavaScript I am converting the image into base64 string..
var ctx = canvas.getContext('2d');
ctx.canvas.width = dimensions.width;
ctx.canvas.height = dimensions.height;
var img = document.getElementsByClassName('croppr-image')[0];
ctx.drawImage(img, dimensions.x, dimensions.y, dimensions.width, dimensions.height, 0, 0, dimensions.width, dimensions.height);
var base64 = canvas.toDataURL("image/png");
I am using asp.net with c# as my backend service where I again convert this base64 string to image to save it on my server.
byte[] bytes = Convert.FromBase64String(text);
Now my question is, on android phone this worked perfect but when using iphone to upload image (taken from iphone camara) Asp.net c# throws an error “Invalid base64 length”!!
I don’t understand why??