I'd like to save the Image retrieved using nativescript-mediafilepicker.
So far I just used the snippet from the github library, but how can I store the image to an object to save it later in a MongoDb database for example ?
What I have
public selectImage(options: ImagePickerOptions): Promise<any>{
return new Promise((resolve, reject) => {
let mediafilepicker = new Mediafilepicker();
mediafilepicker.openImagePicker(options);
mediafilepicker.on("getFiles", function (res) {
let results = res.object.get('results');
console.dir(results);
resolve() // what do I return here ?
});
mediafilepicker.on("error", function (res) {
let msg = res.object.get('msg');
console.log(msg);
reject(msg);
});
mediafilepicker.on("cancel", function (res) {
let msg = res.object.get('msg');
console.log(msg);
reject(msg);
});
})
}
Your help would be appreciated, thanks.
question from:
https://stackoverflow.com/questions/65944583/save-image-to-object-with-nativescript-mediafilepicker 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…