File transfer in cordova

75 views Asked by At

I am trying to download a file from remote server using cordova file transfer plugin in Intel XDK. Here is my code

    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
    ); 

but i am getting error

Uncaught TypeError: Cannot set property 'isDirectory' of null

in VM191 FileTransfer.js:214. How to solve this .Thanks in advance.

1

There are 1 answers

0
Steve W On

maybe you need file:// in your file path?