At the beginning, all worked fine to tranfer files to MongoDB-db but after an upgrade of Android (to Android 10) I can’t tranfer any picture to my MongoDB-db.
async uploadImages(images: string[]){
for (let i = 0; i< images.length; i++){
const element: string = images[i];
let elementName: string = element.substr(element.lastIndexOf('/')+1);
console.log('elementName', elementName);
let fileTransfer: FileTransferObject = this.transfer.create();
const url: string = `${environement.api_url}/Containers/photos/upload`;
console.log('url', url);
let options: FileUploadOptions = {
fileKey: 'Clothy',
fileName: elementName,
//chunkedMode: false,
mimeType: 'image/jpeg',
headers: {}
}
if (!this.imgUploaded){
let data = await fileTransfer.upload(element, url, options);
console.log('data', data);
let id: string = JSON.parse(data.response)._id
console.log('id', id);
console.log('typeof id', typeof id);
this.article.pictures.push(id);
this.numImgUpload += 1;
}
if (this.numImgUpload === images.length){
this.imgUploaded = true;
}
}
return true;
}
and I raise this error :
I read File Transfer was deprecated and I tried this https://github.com/silkimen/cordova-plugin-advanced-http
But I get an error :
Cannot find module '@ionic-native/http/ngx'.
My config
If someone can help