Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-file-transfer

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-file-transfer

react-native plugin for uploading files with multipart/form-data requests

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-native-file-transfer npm version

This little plugin lets you easily upload files from your photo library to a web server using a standard multipart/form-data POST request. It does not incorporate the tranfer of photo library images data from Objective-C to JavaScript (which is slow). The request are being made directly from Objective-C.

installation

  1. npm install react-native-file-transfer;
  2. In xcode: Add RTCFileTransfer.m in Your Project > Libraries > React > Base.

how to use it

When you properly add the RCTFileTransfer.m file to your xcode project you may now use it in the js files. Example usage:

var { NativeModules } = require('react-native');
var obj = {
    uri, // either an 'assets-library' url (for files from photo library) or an image dataURL
    uploadUrl,
    fileName,
    mimeType,
    data: {
        // whatever properties you wish to send in the request
        // along with the uploaded file
    }
};
NativeModules.FileTransfer.upload(obj, (err, res) => {
    // handle response
    // it is an object with 'status' and 'data' properties
    // if the file path protocol is not supported the status will be 0
    // and the request won't be made at all
});

pull-requests welcome

FAQs

Package last updated on 20 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc