fileapi - Copying a file using Cordova -


i've been trying copy file named versions.txt applicationdirectory externalapplicationstoragedirectory using cordova code fails.

here code

var path = cordova.file.applicationdirectory + "www/data/versions.txt";        window.resolvelocalfilesystemurl(path,       function gotfile(fileentry)       {            window.requestfilesystem(localfilesystem.persistent, 0,               function onsuccess(filesystem)               {                        var directory = new directoryentry("versions.txt", path);                        fileentry.copyto(directory, 'versions.txt',                           function()                           {                               alert('copying successful')                           },                           function()                           {                               alert('unsuccessful copying')                           });                }, null);       },null); 

any help?

now works, target directory should resolved.

here solution

window.resolvelocalfilesystemurl(cordova.file.externalapplicationstoragedirectory,                       function onsuccess(direntry)                       {                           //alert(json.stringify(direntry));                            fileentry.copyto(direntry, 'versions.txt',                               function()                               {                                   alert('copying successful')                               },                               function()                               {                                   alert('unsuccessful copying')                               });                       }, null); 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -