{"id":4709,"url":"https://github.com/aroth/react-native-uploader","last_synced_at":"2025-08-04T02:31:23.704Z","repository":{"id":57341149,"uuid":"48333892","full_name":"aroth/react-native-uploader","owner":"aroth","description":"A React Native module to upload files and camera roll assets.","archived":false,"fork":false,"pushed_at":"2019-01-22T03:51:31.000Z","size":442,"stargazers_count":511,"open_issues_count":19,"forks_count":78,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-07-26T16:43:15.716Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aroth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-20T19:18:15.000Z","updated_at":"2025-07-17T08:40:47.000Z","dependencies_parsed_at":"2022-09-08T04:21:57.037Z","dependency_job_id":null,"html_url":"https://github.com/aroth/react-native-uploader","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/aroth/react-native-uploader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aroth%2Freact-native-uploader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aroth%2Freact-native-uploader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aroth%2Freact-native-uploader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aroth%2Freact-native-uploader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aroth","download_url":"https://codeload.github.com/aroth/react-native-uploader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aroth%2Freact-native-uploader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268639931,"owners_count":24282678,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:17:20.947Z","updated_at":"2025-08-04T02:31:23.405Z","avatar_url":"https://github.com/aroth.png","language":"Objective-C","readme":"# react-native-uploader\nA React Native module for uploading files and camera roll assets. Supports progress notification.\n\n## Install\n\n### iOS\n1. `npm install react-native-uploader --save`\n\n2. Link the native modules:\n\nIf you're using React-Native \u003e= 0.29:\n* Link the library with the command `react-native link`\n\nIf you're using React-Native \u003c 0.29:\n* Install rnpm using the command `npm install -g rnpm`\n* Link the library with the command `rnpm link`\n\nIf you have any issues, you can install the library manually:\n* In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n* Go to `node_modules` ➜ `react-native-uploader` ➜ `RNUploader` and add `RNUploader.xcodeproj`\n* In XCode, in the project navigator, select your project. Add `libRNUploader.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n\n3. Run your project (`Cmd+R`)\n\n\n## Example\nSee ./examples/UploadFromCameraRoll\n\n![Example](https://raw.githubusercontent.com/aroth/react-native-uploader/master/examples/UploadFromCameraRoll/uploader.gif)\n\n\n## Usage\n```javascript\nimport React, { Component } from 'react';\n\nimport {\n  StyleSheet,\n  Component,\n  View,\n  DeviceEventEmitter,\n} from 'react-native';\n\nvar RNUploader = NativeModules.RNUploader;\n```\n\n```javascript\ncomponentDidMount() {\n\t// upload progress\n\tDeviceEventEmitter.addListener('RNUploaderProgress', (data)=\u003e{\n\t  let bytesWritten = data.totalBytesWritten;\n\t  let bytesTotal   = data.totalBytesExpectedToWrite;\n\t  let progress     = data.progress;\n\t  \n\t  console.log( \"upload progress: \" + progress + \"%\");\n\t});\n}\n```\n\n```javascript\ndoUpload() {\n\tlet files = [\n\t\t{\n\t\t\tname: 'file[]',\n\t\t\tfilename: 'image1.png',\n\t\t\tfilepath: 'assets-library://....',  // image from camera roll/assets library\n\t\t\tfiletype: 'image/png',\n\t\t},\n\t\t{\n\t\t\tname: 'file[]',\n\t\t\tfilename: 'image2.gif',\n\t\t\tfilepath: \"data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7\",\n\t\t\tfiletype: 'image/gif',\n\t\t},\n\t];\n\n\tlet opts = {\n\t\turl: 'http://my.server/api/upload',\n\t\tfiles: files, \n\t\tmethod: 'POST',                             // optional: POST or PUT\n\t\theaders: { 'Accept': 'application/json' },  // optional\n\t\tparams: { 'user_id': 1 },                   // optional\n\t};\n\n\tRNUploader.upload( opts, (err, response) =\u003e {\n\t\tif( err ){\n\t\t\tconsole.log(err);\n\t\t\treturn;\n\t\t}\n  \n\t\tlet status = response.status;\n\t\tlet responseString = response.data;\n\t\tlet json = JSON.parse( responseString );\n\n\t\tconsole.log('upload complete with status ' + status);\n\t});\n}\n\n```\n\n## API\n#### RNUploader.upload( options, callback )\n\n`options` is an object with values:\n\n||type|required|description|example|\n|---|---|---|---|---|\n|`url`|string|required|URL to upload to|`http://my.server/api/upload`|\n|`method`|string|optional|HTTP method, values: [PUT,POST], default: POST|`POST`|\n|`headers`|object|optional|HTTP headers|`{ 'Accept': 'application/json' }`|\n|`params`|object|optional|Query parameters|`{ 'user_id': 1  }`|\n|`files`|array|required|Array of file objects to upload. See below.| `[{ name: 'file', filename: 'image1.png', filepath: 'assets-library://...', filetype: 'image/png' } ]` |\n\n`callback` is a method with two parameters:\n\n||type|description|example|\n|---|---|---|---|\n|error|string|String detailing the error|`A server with the specified hostname could not be found.`|\n|response|object{status:Number, data:String}|Object returned with a status code and data.|`{ status: 200, data: '{ success: true }' }`|\n\n\n#### `files`\n`files` is an array of objects with values:\n\n||type|required|description|example|\n|---|---|---|---|---|\n|name|string|optional|Form parameter key for the specified file. If missing, will use `filename`.|`file[]`|\n|filename|string|required|filename|`image1.png`|\n|filepath|string|required|File URI\u003cbr\u003eSupports `assets-library:`, `data:` and `file:` URIs and file paths.|`assets-library://...`\u003cbr\u003e`data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOV...`\u003cbr\u003e`file:/tmp/image1.png`\u003cbr\u003e`/tmp/image1.png`|\n|filetype|string|optional|MIME type of file. If missing, will infer based on the extension in `filepath`.|`image/png`|\n\n### Progress\nTo monitor upload progress simply subscribe to the `RNUploaderProgress` event using DeviceEventEmitter.\n\n```\nDeviceEventEmitter.addListener('RNUploaderProgress', (data)=\u003e{\n  let bytesWritten = data.totalBytesWritten;\n  let bytesTotal   = data.totalBytesExpectedToWrite;\n  let progress     = data.progress;\n  \n  console.log( \"upload progress: \" + progress + \"%\");\n});\n```\n\n### Cancel\nTo cancel an upload in progress:\n```\nRNUploader.cancel()\n```\n\n### Notes\n\nInspired by similiar projects:\n* https://github.com/booxood/react-native-file-upload\n* https://github.com/kamilkp/react-native-file-transfer\n\n...with noteable enhancements:\n* uploads are performed asynchronously on the native side\n* progress reporting\n* packaged as a static library\n* support for multiple files at a time\n* support for files from the assets library, base64 `data:` or `file:` paths \n* no external dependencies (ie: AFNetworking)\n\n## License\n\nMIT\n","funding_links":[],"categories":["Components"],"sub_categories":["Backend"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faroth%2Freact-native-uploader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faroth%2Freact-native-uploader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faroth%2Freact-native-uploader/lists"}