Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
290 views
in Technique[技术] by (71.8m points)

Save image to object with Nativescript MediaFilePicker

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...