0
我想上傳一個文件離子2和cordova文件傳輸。但我的服務器不斷返回內容長度丟失的錯誤。我怎樣才能把這個添加到我的上傳頭文件中?離子2文件傳輸不添加內容長度
let options: FileUploadOptions = {
fileKey: 'file',
fileName: fileName,
httpMethod: "PUT",
mimeType: 'image/jpeg',
chunkedMode: true,
headers: {
'x-ms-blob-type': 'BlockBlob',
'Content-Type': 'image/jpeg'
}
}
this.fileTransfer.upload(filePath, submitUri, options, true)
.then((data) => {
debugger;
this.loading.dismiss();
let alert = this.alertCtrl.create({
title: 'Upload Success',
subTitle: 'Your image has successfully been uploaded.',
buttons: ['Dismiss']
});
alert.present();
}, (err) => {
this.loading.dismiss();
debugger;
let alert = this.alertCtrl.create({
title: 'Upload Error',
subTitle: 'An error occured while uploading your image. Please try again.',
buttons: ['Dismiss']
});
alert.present();
})
你可以添加你的代碼嗎?你使用的是哪個版本的插件?在哪個平臺上測試(Android,iOS)? – e666
添加我的代碼並使用1.6.2並在android上進行測試。 –