FIle copyTo not working in cordova

老子叫甜甜 提交于 2019-12-11 13:44:02

问题


In my cordova(v 3.3) application i used copyTo for copy files from one directory to another directory in sdcard. Some time it is working fine some time it is not working. Here is the source i used to copy files from one dierctory to another.

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function gotFS(fileSystem) {
         var root = fileSystem.root.fullPath;
         console.log(skiTemplateFileName);
         alert(root);

         var fails = function(err) { alert(err.code);}
            window.resolveLocalFileSystemURI(root+"/"+TEMPLATE_DIRECTORY+""+TemplateFileName, function(file) {
               window.resolveLocalFileSystemURI(root+"/"+PDF_DIRECTORY, function(destination) {
                         file.copyTo(destination,randomFileName);
                         alert("File Download Successfully");
               },fails)
            },fails);
     }, function fail(e){

     });

when copy files first time only shows the file download success. For next time it shows only root alert

Note : This issue occurs in samsung tab 4(v4.4.2) devices working well in nexus 7.

Please guide to solve this issue.

来源:https://stackoverflow.com/questions/27455884/file-copyto-not-working-in-cordova

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!