I am capturing image on browser and by clicking the Take Snapshot button image gets download in Browser Default Download Folder. But I want to download it in particular path. (I don’t want to change default download path of browser).
I have attached code below.
Webcam.set({
width: 320,
height: 240,
image_format: 'jpeg',
jpeg_quality: 90
});
Webcam.attach('#my_camera');
var shutter = new Audio();
shutter.autoplay = false;
shutter.src = navigator.userAgent.match(/Firefox/) ? 'webcamjs/shutter.ogg' : 'webcamjs/shutter.mp3';
takeSnapShot = function () {
Webcam.snap(function (data_uri) {
downloadImage('Developer', data_uri);
});
}
downloadImage = function (name, datauri) {
var a = document.createElement('a');
a.setAttribute('download', name + '.png');
a.setAttribute('href', datauri);
a.click();
}
#my_camera {
width: 320px;
height: 240px;
border: 1px solid black;
}
<div id="my_camera"></div>
<input type="button" value="Take Snapshot" onClick="takeSnapShot()">
<div id="results"></div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/webcamjs/1.0.25/webcam.js"></script>