科尔多瓦中的文件传输

问题描述 投票:0回答:1

我正在尝试使用 cordova 文件传输插件从远程服务器下载文件 英特尔XDK。这是我的代码

    var path ='/New_Directory/1.pdf'; 
    /*here New_Directory is my newly created directory by using  
    directoryEntry.getDirectory   */
    var uri = encodeURI("remote_location/file_name"); 
    var fileTransfer = new FileTransfer();   
    fileTransfer.download(uri,path,
        function(entry) {
            alert("Success !!");            
        },
        function(error) {
           alert("Failed"); 
        },
        false
    ); 

但我收到错误

Uncaught TypeError: Cannot set property 'isDirectory' of null

在 VM191 FileTransfer.js 中:214。 如何解决这个问题。提前致谢。

cordova intel-xdk
1个回答
0
投票

也许您的文件路径中需要 file:// ?

© www.soinside.com 2019 - 2024. All rights reserved.