How do I convert from a img src to a input of type file?
I'm using webcamjs and it gives me a data_uri for an image src that looks like this
Webcam.snap(function(data_uri) {
document.getElementById('my_result_front').innerHTML
= '<img id="webcamImageToCropFront" src="' + data_uri + '"/>';
});
and now I need to convert the image source into a file that I can pass to my form like this
const data = new FormData();
data.append('file', document.querySelector('#id-file').files[0]);
where #id-file is a input of type file like this
<input type="file" id="id-file" name="id-file" accept=".jpeg,.jpg,.png">