rn-firebase-storage-upload-sample icon indicating copy to clipboard operation
rn-firebase-storage-upload-sample copied to clipboard

Download from firebase

Open funkysoul opened this issue 8 years ago • 4 comments

hey @wkh237 what would be the best way to download an image stored in firebase when uploaded as a blob?

This is how I upload to storage: window.XMLHttpRequest = RNFetchBlob.polyfill.XMLHttpRequest; window.Blob = Blob; ... uploadProfilePicture(file){ var that = this; const rnfbURI = RNFetchBlob.wrap(file); Blob .build(rnfbURI, { type : 'image/jpeg;'}) .then((blob) => { console.log("userID from upload: " + userID); console.log("POSTKEY from upload: " + newPostKey); this.fb.storage() .ref('photos/' + userID) .child('profile_image.jpg') .put(blob, { contentType : 'image/jpeg' }) .then((snapshot) => { blob.close() done() }) }) } ....

and is this how I'm supposed to download an image? ... this.fb.storage().ref('photos').child("test.jpg").getDownloadURL().then((url) => { RNFetchBlob .config({ fileCache : true, appendExt : 'jpg' }) .fetch('GET', url) .then((resp) => { console.log(resp); }) }) ...

the above returns nothing, using the default firebase implementation also results nothing

Kind of lost here, as soon as I hook up your library with verbose on I see that my request to grab the downloadURL is being handled by the XMLHttpRequest polyfill.

Many thanks for your help mate!

funkysoul avatar Nov 22 '16 13:11 funkysoul

Hi @funkysoul , I think this may related to Firebase SDK's version, and we are still try to find where's the problem. You may try use Firebase 3.4.1 and see if it works.

wkh237 avatar Nov 22 '16 16:11 wkh237

Most likely that it will work for you on 3.5.3 as well (That's the newest one that will be working for you)

tomershohet avatar Nov 22 '16 17:11 tomershohet

Thanks for the great information, I think that really helpful !

wkh237 avatar Nov 23 '16 00:11 wkh237

There's a new release of react-native-fetch-blob, please try upgrade the package to 0.10.1-beta.1 and see if that fix the issue 👍

wkh237 avatar Nov 23 '16 02:11 wkh237