Skip to content Skip to sidebar Skip to footer

React-native Upload Pictures On Android

I have a react-native app on Android and a backend server written in NodeJS + Express and I'm using multer to handle file uploads. const multer = require('multer'); const mime = re

Solution 1:

Fetch may not support Blob and FormData at this moment, but you can use XMLHttpRequest polyfill instead.

  let xhr = new XMLHttpRequest()
  xhr.open('post', `http://myserver.com/upload-form`)
  xhr.send(form)
  xhr.onerror = function(e) {
    console.log('err', e)
  }
  xhr.onreadystatechange = function() {
    if(this.readyState === this.DONE) {
      console.log(this.response)
    }
  }

Post a Comment for "React-native Upload Pictures On Android"