So Basically I am capturing an image through camera with some html5 vidoe
, canvas
and button
tags, But before I upload this image to server I need to save the image to the internet temporary directory and then access the image and upload the image to server, So far I could do is to capture the canvas image but don't know how to save it in the local pc internet temp directory, I found an already asked question which the answer was
var image = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
window.location.href=image;
the problem with above code is that it pops the download box to client and request the client where to save it, but I need to save the image without prompting anything to user and save it to internet temp direcotry.
here is the code where I take the canvas image
document.getElementById("snapButton").addEventListener("click", function() {
context.drawImage(video, 0, 0, 640, 480);
var myImg = document.getElementById("myImg");
myImg.src = canvas.toDataURL();
});
so I would really appreciate if somebody tell me what code do I add to above eventListener
to save the image.