This code works fine when running on device, but when I run the same code in browser build it fails with FileTransferError code 1
. Do anybody have success using FileTransfer in a browser build?
getPicture(uploadUrl, token) {
const options: CameraOptions = {
quality: 100,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
}
return this.camera.getPicture(options).then(imageData => {
const fileTransfer: FileTransferObject = this.transfer.create()
const fileName = 'image.jpeg'
let options = {
fileKey: 'file',
fileName: 'image.jpeg',
headers: {
Authorization: 'Bearer ' + token
}
}
return fileTransfer
.upload(imageData, uploadUrl, options)
})
}