我正在尝试使用ionic 2和cordova-file-transfer上传文件。但我的服务器一直返回错误内容长度丢失的错误。如何将其添加到我的上传标题?
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();
})
答案 0 :(得分:1)
chunkedMode: false,
更改为{{1}}
我正在使用android,上传到azure blob。