0.0.2 • Published 8 years ago

react-native-file-uploader v0.0.2

Weekly downloads
11
License
-
Repository
github
Last release
8 years ago

react-native-file-uploader npm version

An iOS and Android cross patform React Native module to upload files from the device local storage to a server using a multipart/form-data request.

Installation

$ npm install react-native-file-uploader --save
$ rnpm link react-native-file-uploader

Usage

import FileUploader from 'react-native-file-uploader'

const settings = {
  uri,
  uploadUrl,
  method, // default to 'POST'
  fileName, // default to 'yyyyMMddhhmmss.xxx'
  fieldName, // default to 'file'
  contentType, // default to 'application/octet-stream'
  data: {
    // extra fields to send in the multipart payload
  }
};

FileUploader.upload(settings, (err, res) => {
  // handle result
}, (sent, expectedToSend) => {
  // handle progress
});
      

Supported uri types

ios

  • file:
  • absolute path

android

  • file:
  • content:
  • absolute path