Hi guys,
my app take a picture and then try to upload to S3.
I use the File Transfer plugin, and I need to set ‘Content-Length’ to the array header.
I do:
let options: FileUploadOptions = {
fileKey: 'file',
fileName: 'name.jpg',
mimeType: "image/jpeg",
httpMethod: "PUT",
chunkedMode: false,
headers: {
"Content-Type": 'image/jpeg',
'Content-length' : ????
},
}
fileTransfer.upload(this.imagePath, url.url, options)
.then((data) => {
// success
console.log("success: " , data);
}, (err) => {
// error
console.log("error upload:", JSON.stringify(err, null, 4));
})
this.imagePath is the path of the taken picture from camera, it’s like this:
file:///storage/emulated/0/Android/data/it.oandsi.photoshoot.com/cache/1522925072046-cropped.jpg?1522925073891
I have only the path because in configuration of the camera I specified:
destinationType: this.camera.DestinationType.FILE_URI,
How to get the length of the picture?
Thanks!