Function savefile(); exports default to downloads folder

Asked

Viewed 35 times

1

Good morning I would like a help, the function is exporting straight to download folder, I would like to be able to choose which folder to save the file on. I still can not see a solution for this functionality, I thank all who are willing to give me a help or even a direction, hug!

function saveFile(){
var textToSave = document.getElementById("wmd-input").value;
var textToSaveAsBlob = new Blob([textToSave], {type:"text/plain"});
var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);
var fileNameToSaveAs = document.getElementById("inputFileName").value;

var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs+".md";
downloadLink.innerHTML = "Download File";
downloadLink.href = textToSaveAsURL;
downloadLink.onclick = destroyClickedElement;
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);

downloadLink.click();

}

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.