Skip to content

File Storage Doesn't Work w/React Native #5

Description

@aaronksaunders

I believe this is an issue in React-Native's implementation of the binary upload, but I will start here since I am getting an error message back

error {"code":"storage/unknown","message":"Firebase Storage: An unknown error occurred, please check the error payload for server response.","serverResponse":"Multipart body does not contain 2 or 3 parts.","name":"FirebaseError"}

Code

var fileRef = firebase.storage().ref('images/sample-text')
var uploadTask = fileRef.put(new File(['this is a small amount of data'], 'sample-text.txt', { type: "text/plain" }), { type: "text/plain" });

uploadTask.on('state_changed', function (snapshot) {
    console.log('state_changed', snapshot);
}, function (error) {
    console.log("error", JSON.stringify(error));
}, function () {
    // Handle successful uploads on complete
    // For instance, get the download URL: https://firebasestorage.googleapis.com/...
    var downloadURL = uploadTask.snapshot.downloadURL;
})

I see the same issue on IOS/Android... goes into the Firebase source and then it is over...

BTW the code works in regular reactJS

See here... https://jsfiddle.net/Aaronksaunders/69z2wepo/48545/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions