在错误代码中需要帮助。我正在尝试从源服务器下载图像(只是来自某个网站的图像)。始终在文件传输中获取错误代码1。我知道错误代码1表示找不到文件。但该文件可用。请找到我的代码和错误。
public downloadImage() {
var url = "http://weknowyourdreams.com/images/mountain/mountain-04.jpg";
var targetPath = '/assets/Images/menucategory/';
const fileTransfer: TransferObject = this.transfer.create();
fileTransfer.download(url,targetPath + 'file.jpg' )
.then(data =>
{
this.presentToast('Image succesful downloaded.');
},
err => {
console.log('download error source', err.source);
console.log('download error targer', err.target);
console.log('download error code', err.code);
console.log('download error ', err);
this.presentToast('Error while downloading file.');
});
}
错误详情:
体:空 代码:1 例外:空 HTTP_STATUS:空 源:" http://weknowyourdreams.com/images/mountain/mountain-04.jpg" 目标:" /assets/Images/menucategory/file.jpg"