2

I have a base64 image string generated from a Signature panel. Now I want to get the base64 string to be converted to an Image and saved to a file Path Maybe on Drive C:\images How can I do something like this

function SaveBase64toImagePath(){

document.form1.base64TextString.value += obj.imageData;
var base64string = document.form1.base64TextString.value;

var fullString = '<img src="data:image/png;base64,+ base64string + " alt="">';

...

save to directory
}
Dorian
  • 31
  • 4
  • You cannot access the filesystem from javascript directly, so saving to C:/images is not possible, but as suggested in the answer bellow you can "download" a file – Dellirium Jan 14 '19 at 13:30
  • Does this answer your question? [JavaScript: Create and save file](https://stackoverflow.com/questions/13405129/javascript-create-and-save-file) – ChrisM Jul 22 '20 at 21:18

1 Answers1

0

try es6 templates with ${variable};

var fullString = `<img src="data:image/png;base64${base64string}" alt="">`;

and then you can save image from img tag

JavaScript: Create and save file

Vadim Hulevich
  • 1,803
  • 8
  • 17