I have the base64 data for an image that i need to convert it into file type and send it to server can any one help me to fix this problem?
var base64_string = "/9j/4AAQSkZJRgABAgAAAQABAAD//...";
var img = document.createElement("img");
// added `width` , `height` properties to `img` attributes
img.width = "250px";
img.height = "250px";
img.src = "data:image/png;base64," + base64_string;
var preview = document.getElementById("img_preview");
preview.appendChild(img);