react-native-file-transfer
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
npm install react-native-file-transfer
;- In xcode: Add
RTCFileTransfer.m
inYour 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 = ;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 ;NativeModulesFileTransfer;
pull-requests welcome