Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Upload to Firebase with Android images with prefix 'content://' fails to complete #110

Closed
@MrRoyce

Description

@MrRoyce

Hi there, I've been able to upload images to FireBase with the uri of type '/storage/emulated/0/DCIM/Camera/IMG_20160626_154052.jpg' however, when I use the library, https://github.com/jeanpan/react-native-camera-roll-picker it returns the URI in the format 'content://media/external/images/media/20038'

The uploads complete, but they only send a minimal amount of data (e.g. 31 bytes) to FireBase out of the 1.5m file?

Is it a matter of the 'type' in the Blob.build and the 'contentType' in the put being set properly?

Also, do I assume I should not use theRNFetchBlob.wrap() with files with the 'content:' prefix? I tried it with the wrap and it fails with the RN callback error and without the wrap() it fails as described above.

This is what I'm using now:

...
    Blob.build(rnfbURI, { type : 'image/jpg;BASE64'})  // rnfbURI is NOT wrapped 
    .then((blob) => {
      firebaseApp.storage()
        .ref('images')
        .child(testImageName)
        .put(blob, { contentType : 'image/jpg' })
        .then(() => {
          blob.close();
      })
...

Thanks again for you help.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions