Upload image to firebase storage using expo


#1

Hello,

I have been stuck for 3 days trying to upload an image to my firebase storage. I keep getting a “Network request failed” error and literally dont know what to do.

Here is my code

    async writeUserData() {
        const response = await fetch(this.state.image);
        const blob = await response.blob();
        firebase.storage().ref().child("image/test");
        return ref.put(blob).then(()=>{
            alert("success");
        }).catch((error)=>{
            alert(error);
        });
    }

this.state.image holds the image uri


#2

Hey @enoch2000,

If your project is running SDK31, this may be related to a known issue with blob in RN. There is a temporary fix that you can read about here: https://github.com/facebook/react-native/pull/22063 Let me know if that resolves the issue.

Cheers,

Adam


closed #3

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.