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.

RNFetchBlob.fetchBlobForm failed to create request body #437

Open
@hstoebel

Description

@hstoebel

React-Native: 0.46.3
RNFB: 0.10.6

I am trying to upload a selected image from the camera roll using react-native-image-picker. The following works fine on Android but on ios I get warning: Error: RNFetchBlob.fetchBlobForm failed to create request body. Any idea what I'm doing wrong?

    ImagePicker.showImagePicker(options, (response) => {
      if (response.didCancel) {
        console.warn('User cancelled image picker');
      }
      else if (response.error) {
        console.warn('ImagePicker Error: ', response.error);
      }
      else if (response.customButton) {
        console.warn('User tapped custom button: ', response.customButton);
      }
      else {

        RNFetchBlob.fetch('POST', 'http://12.34.56.78:3000/upload', 
          {'Content-Type' : 'multipart/form-data'}, 
          [
            { name : 'from_device', filename : 'from_device.png', type:'image/png', data: RNFetchBlob.wrap(response.uri)},
          ]
        ).then((resp) => {
          console.warn(resp);
        }).catch((err) => {
          console.warn(err);
        })

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions