In this project my purpose is sending local image url to python or saving image to specific folder.
I am using bootstrap in this link: "https://codepen.io/aaronvanston/details/yNYOXR" for my project. I am uploading image.
https://i.stack.imgur.com/PtMxX.jpg
My javascript code in belong. How can ı take local image url or how can I save image to new file?
function readURL(input) {
localStorage.setItem("./imgData.jpg", input.files[0]);
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('.image-upload-wrap').hide();
$('.file-upload-image').attr('src', e.target.result);
var fs;
// string generated by canvas.toDataURL()
var img = e.target.result;
// strip off the data: url prefix to get just the base64-encoded bytes
var data = img.replace(/^data:image\/\w+;base64,/, "");
fs.writeFile('image.jpg', data);
$('.file-upload-content').show();
$('.image-title').html(input.files[0].name);
};
reader.readAsDataURL(input.files[0]);
} else {
removeUpload();
}
}
strong text