downloadUrl“未定义”,不发送img

时间:2019-02-02 21:33:02

标签: javascript firebase ionic-framework firebase-storage

我尝试将图像发送到我的Firebase存储,但他不发送图像,而我也无法获得他的下载网址:

updateChannelPicture(channelKey, image) { // image send me a data_url
    var promise = new Promise((resolve, reject) => {
        const channelPicturesRef = firebase.storage().ref('channels/' + channelKey);
        channelPicturesRef.putString(image, 'data_url').then((res) => { 
            console.log('Save image: ', res.downloadURL); // At this console he return undefined
            resolve({ success: true, picUrl: res.downloadURL });
        }).catch((err) => {
            console.log('Error save image: ', err);
            resolve({ success: false, error: err.message });
        });
    });
    return promise;

}

0 个答案:

没有答案