2014-05-14 384 views
0

我有點困惑與科爾多瓦的iOS文件傳輸方法。 (我有一個Android版本)文件傳輸下載與科爾多瓦3.4 iOS 7的

顯然,我沒有正確設置目標文件夾。 target:nullCould not create target file請注意,我認爲該目錄存在,因爲它是在腳本的早期成功創建的。

根據科爾多瓦文件,我應該使用entry.toURL來找到正確的道路。

function download(filename){ 
    var localPath = rootFS.toURL+'contentImages/'+filename; 
    var fileTransfer = new FileTransfer(); 
    fileTransfer.download(encodeURI('http://myValidatedSource.com/'+filename), 
     localpath, 
     function(entry){ 
      console.log('download completed for '+entry.fullPath); 
     }, 
     function(error){ 
      console.log(error); 
     } 
    ); 
} 

我也試過這樣:

alert(rootFS.fullPath);  ==> "/" 

alert(rootFS.toURL);   ==> "function(){ 
           if (this.nativeURL){ 
            return this.nativeURL; 
            } 
           return this.toInternalURL()|| "file://localhost"+this.fullPath"; 
           }" 

回答

0

我沒有那麼遠,

var localPath = rootFS().toURL+'contentImages/'+filename; 

,而不是

var localPath = rootFS.toURL+'contentImages/'+filename; 
相關問題