![]() Whereever my this index.html file will go, it will download the file and save it along index.html file. and its giving me the path as /C:/Users/Public/Desktop/ so I want to save file here. For this I am picking the path from the following code. So I want to download this file from where its called. When I run this file in my browser from file:///C:/Users/Public/Desktop/ then it download the file and save it at file:///C:/Users/Public/Downloads/. Like I am using this code offline and just have the upper code in my index.html file. Var textFromFileLoaded = ĭocument.getElementById("inputTextToSave").value = textFromFileLoaded įileReader.readAsText(fileToLoad, "UTF-8") īut I want to download it on different location. Var fileToLoad = document.getElementById("fileToLoad").files įileReader.onload = function(fileLoadedEvent) ![]() Firefox requires the link to be added to the DOMĭownloadLink.href = (textFileAsBlob) ĭownloadLink.onclick = destro圜lickedElement without actually adding it to the DOM.ĭownloadLink.href = (textFileAsBlob) Var downloadLink = document.createElement("a") ĭownloadLink.download = fileNameToSaveAs ĭownloadLink.innerHTML = "Download File" Var fileNameToSaveAs = document.getElementById("inputFileNameToSaveAs").value Var textToWrite = document.getElementById("inputTextToSave").value I am downloading files using HTML5 from below codes that you can see live in action at JSBIN HTML5 Download File DEMO and its working perfectly file and downloading my files at my browser default Download Folder.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |