2017-06-12 52 views
0

我試圖下載一個PDF文件的形式傳輸的插件代碼:3,回報於連接錯誤CONNECTION_ERR在傳輸插件

fileTransfer.download(url+'?token=XXXXXX121b42867f03b7f1701e8f8656566a5', this.file.dataDirectory + file.filename).then((entry) => { 
     loader.dismiss(); 

     console.log('download complete: ' + entry.toURL()); 

     }, (error) => { 
     // handle error 

     console.log(error); 
     console.log('ERROR'); 


     }); 

我總是調用我的傳遞插件的錯誤部分。

我知道這是與我的令牌有關我已盡我所能,但我想知道我是否正確地傳遞我的令牌爲什麼我總是調用錯誤部分。

+0

你在錯誤回調得到什麼錯誤? – Gandhi

+0

我沒有得到任何錯誤我正在調用我的插件的錯誤部分我沒有得到下載成功的一部分@Gandhi –

+0

確實明白這一點。當你做console.log時,打印的錯誤對象是什麼? – Gandhi

回答

0

我漸漸因爲這個空間我是調用錯誤部分文件名作爲demo sample.pdf

的解決方案是encodeURI(url)

fileTransfer.download(encodeURI(url+'?token=XXXXXX121b42867f03b7f1701e8f8656566a5'), this.file.dataDirectory + file.filename).then((entry) => { 
     loader.dismiss(); 

     console.log('download complete: ' + entry.toURL()); 

     }, (error) => { 
     // handle error 

     console.log(error); 
     console.log('ERROR'); 


     }); 
相關問題