The problem does not happen on Android. Only IOS.
So I have a HTML form which takes capture from a camera or photo. Android files are fine but IOS are not.
Small to Medium files probably less than 200kb are fine on IOS. Anything large and it does not work, both image from gallery or camera. On the iOS you get the option to reduce the file size before uploading it and so the small images do work.
I get an error in JS which says "unterminated string literal" which means its corrupt or not completed.
This has been with all of the IOS devices (iPad and Iphones), latest versions of Safari as well.
What could be a way around this whilst still maintaining the same code. Are there some sort of base64 size limits on iOS.
async function saveimage()
{
var imageexists = false;
var base64result = document.getElementById("b64txt").value.split(',')[1];
var filetype = document.getElementById("b64txt").value.split(',')[0];
var filename = document.forms[1]['pic'].files[0].name;
//check if file already exists
for (i = 0; i < images.length; i++) {
if (images[i].base64 == base64result && images[i].filetype == filetype && images[i].filename == filename) { imageexists=true}
}
if (imageexists == false) {
var img = new image(base64result,filename , filetype);
images.push(img);
var json = JSON.stringify(images);
document.getElementById("ContentPlaceHolder1_hd_images").value = json;
}
showthumbnails()
}
I have checked the size and charachter limits on the devices using a snippet that checks for memory allocation. All seems reasonable. Its well above what I need as the average photo will be 3-5MB.
Could it be that the HTML element has an issue with the length of a string since the code is storing data inside an element?