Iam doing a project in html, javascript only. I have a function that convert image to base64, see the code below.
function getBase64Image()
{
p = document.getElementById("picField").value;
img.setAttribute('src', p);
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
var dataURL = canvas.toDataURL("image/png");
var r = dataURL.replace(/^data:image\/(png|jpg);base64,/, "");
base64 = r;
alert(base64);
}
but the problem is when I deployed my website, means when I placed my html file on iis, its not working, means in local file system it is showing complete base 64 format like iVb...., but on iis it giving base64 code as just "base,". so why it is not working on iis i dont know, so please help me and send me html file that will work on iis too.