Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
279 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 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...