cordova - Not able to create text file inside the folder in phonegap -


i working on code create text file inside directory.

i googled , found code on device ready.

but not working.

i used filesystem.getdirectory instead of filesystem.root.getfile.

code:

function gotfs(filesystem) {     // create dir     alert("jjßß")     filesystem.root.getfile("newdir", {         create: true,         exclusive: false     }, gotdirentry, fail); }  function gotdirentry(direntry) {     // create file     direntry.getfile("newfile.txt", {         create: true,         exclusive: false     }, gotfileentry, fail); }  function gotfileentry(fileentry) {     fileentry.createwriter(gotfilewriter, fail); }  function gotfilewriter(writer) {     writer.onwrite = function (evt) {         console.log("write completed");     };     writer.write("some sample text");     writer.abort(); }  function fail(error) {     console.log(error.code); } 

you can try following code:

window.requestfilesystem(localfilesystem.persistent, 0, function (fs)  {     var fullpathtowrite = fs.root.fullpath; //this "working" directory saving files } 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -