react-native-uploader icon indicating copy to clipboard operation
react-native-uploader copied to clipboard

Video upload support

Open kitsune7 opened this issue 7 years ago • 5 comments

Is it possible to upload videos with this plugin? If not, that would be VERY desirable in my book.

If you can upload video already, could we add some documentation so that people know how to do it?

kitsune7 avatar Apr 20 '17 19:04 kitsune7

+1

isAlmogK avatar Aug 07 '17 00:08 isAlmogK

Yes, you can. I've been using this library for the past couple months to upload videos. It essentially works the same as uploading a photo; point to the file on your devices, give it the proper meta data and then upload.

ericcastro92 avatar Aug 10 '17 22:08 ericcastro92

Thanks

isAlmogK avatar Aug 13 '17 00:08 isAlmogK

@ericcastro92 I tried this library and I am getting error "400"

async doUpload(magazineCoverUri, magazineCoverId) {
    await this.refs.viewShot.capture().then(uri => {
      this.setState({
        img: {
          uri: uri,
        },
      });
    });

    let files = [
      {
        name: "cover_image",
        filename: "image1.jpg",
        filepath: magazineCoverUri,
      },
      {
        name: "design_cover_image",
        filename: "image2.jpg",
        filepath: this.state.img.uri,
      },
    ];

    let opt = {
      url:
        GLOBAL.API_URL + "/uploadMagazineCoverImage/" + magazineCoverId,
      files: files,
      method: "POST",
      headers: {
        Accept: "application/json",
        "Content-Type": "multipart/form-data",
        Authorization: this.state.access_token,
      },
    };

    console.log(opt);

    await RNUploader.upload(opt, (err, res) => {
      if (err) {
        console.log("--------->" + err);
        return;
      }

      console.log(res.status);
      console.log("===========================");
      // console.log(err);
    });
  }

devendrabhandari avatar Apr 13 '18 18:04 devendrabhandari

Can you add the ability to upload the video in chunks and be able to specify a custom header for each chunk uploaded?

milesmeow avatar Nov 15 '18 23:11 milesmeow