{"id":16978691,"url":"https://github.com/srph/react-uploadi","last_synced_at":"2026-02-06T07:31:20.012Z","repository":{"id":57162203,"uuid":"117697287","full_name":"srph/react-uploadi","owner":"srph","description":"Build upload UIs with dropzone and previews out of the box.","archived":false,"fork":false,"pushed_at":"2018-02-13T22:37:17.000Z","size":122,"stargazers_count":3,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-05T13:39:21.864Z","etag":null,"topics":["reactjs","render-props","upload"],"latest_commit_sha":null,"homepage":"https://react-uploadi.kierb.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/srph.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-16T14:54:14.000Z","updated_at":"2018-03-09T09:19:54.000Z","dependencies_parsed_at":"2022-09-10T02:33:55.350Z","dependency_job_id":null,"html_url":"https://github.com/srph/react-uploadi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/srph/react-uploadi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Freact-uploadi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Freact-uploadi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Freact-uploadi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Freact-uploadi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srph","download_url":"https://codeload.github.com/srph/react-uploadi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Freact-uploadi/sbom","scorecard":{"id":844234,"data":{"date":"2025-08-11","repo":{"name":"github.com/srph/react-uploadi","commit":"463bfcd681c9a722396934040f759e5e684e96a9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-23T21:05:37.122Z","repository_id":57162203,"created_at":"2025-08-23T21:05:37.123Z","updated_at":"2025-08-23T21:05:37.123Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29154290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T07:18:23.844Z","status":"ssl_error","status_checked_at":"2026-02-06T07:13:32.659Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["reactjs","render-props","upload"],"created_at":"2024-10-14T01:44:01.401Z","updated_at":"2026-02-06T07:31:19.855Z","avatar_url":"https://github.com/srph.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Uploadi [![npm version](https://img.shields.io/npm/v/@srph/react-uploadi.svg?style=flat-square)](https://npmjs.com/packages/@srph/react-uploadi) [![Build Status](https://img.shields.io/travis/srph/react-uploadi.svg?style=flat-square)](https://travis-ci.org/srph/react-uploadi?branch=master)\nBuild upload UIs with dropzone and previews out of the box.\n\n- Provides a terse API to implement file upload.\n- Removes the effort of dealing with [FileReader](https://developer.mozilla.org/en-US/docs/Web/API/FileReader) (usually needed to display the preview of uploaded photos).\n- Dropping of files is built out of the box.\n- Doesn't assume markup, styling, or template.\n\n**Most importantly**, unlike [Dropzone.js](http://www.dropzonejs.com/), Uploadi does not handle the actual uploading of the files to a 3rd-party service / API. This means that you will have to handle ajax, maintaining the loading, progress, and error state by yourself.\n\nAlthough Uploadi was meant for advanced use-cases, you are not alone by all means. Check out the [online examples](https://react-uploadi.kierb.com/) or view its [source code](storybook/uploadi.js). It showcases Uploadi's power from the simplest case to a full-blown file upload.\n\n## How It Works\nThis library uses the render props pattern. You can read more about it [here](https://cdb.reacttraining.com/use-a-render-prop-50de598f11ce).\n\n## Installation\n```bash\nnpm install @srph/react-uploadi --save\n```\n\n### Script tags\nIf you're not using a bundler like Browserify or Webpack, simply add the script tag after your React script tag.\n\n```html\n\u003c!-- Script tags for React and other libraries --\u003e\n\u003cscript src=\"https://unpkg.com/@srph/react-uploadi/dist/react-uploadi.min.js\"\u003e\u003c/script\u003e\n```\n\nThis library is exposed as `ReactUploadi` (e.g., `\u003cReactUploadi /\u003e`).\n\n## Usage\nThe following lets you build a single-file uploader:\n\n```js\nimport React from 'react'\nimport Uploadi from '@srph/react-uploadi'\n\nclass App extends React.Component {\n  state = {\n    // Here goes the base64 parsed event\n    image: '',\n    // Here goes the original File which you may\n    // need when uploading to an API / any kind of backend.\n    // In most cases, you will use formdata with it.\n    file: null\n  }\n\n  render() {\n    const {image} = this.state\n\n    return (\n      \u003cUploadi onFiles={this.handleFiles}\u003e\n        {({onSelect}) =\u003e (\n          \u003cdiv\u003e\n            {image ? \u003cimg src={image} /\u003e : 'Select a file to upload.'}\n            \u003cbutton onClick={onSelect}\u003e\n              Browse\n            \u003c/button\u003e\n          \u003c/div\u003e\n        )}\n      \u003c/Uploadi\u003e\n    )\n  }\n\n  handleFiles = (file, image) =\u003e {\n    this.setState({\n      file,\n      image\n    })\n  }\n}\n\nexport default App;\n```\n\n\u003e **NOTE**: Regarding the `onFiles` callback prop \u0026mdash; The first parameter contains the original [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) event _may_ need in order to upload the selected file.\n\u003e\n\u003e The second parameter contains the [encoded string (contents of the file)](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/result): a [base64-encoded string](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL) if it's an image, otherwise [a text string](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsText).\n\nView more [examples](storybook/uploadi.js).\n\n### Multiple files\nYou can make your uploader accept multiple files by passing the `multiple={true}` prop to `Uploadi`. Take note that the `onFiles` callback is slightly different: You will receive an array of `File`s and encoded strings.\n\n```js\nclass App extends React.Component {\n  state = {\n    images: [],\n    files: []\n  }\n\n  render() {\n    const {images} = this.state\n\n    return (\n      \u003cUploadi multiple onFiles={this.handleFiles}\u003e\n        {({onSelect}) =\u003e (\n          \u003cdiv\u003e\n            {images.length\n              ? images.map((image, i) =\u003e (\n                \u003cimg src={image} key={i} /\u003e\n              )) : 'Select a file to upload.'\n            }\n\n            \u003cbutton onClick={onSelect}\u003e\n              Browse\n            \u003c/button\u003e\n          \u003c/div\u003e\n        )}\n      \u003c/Uploadi\u003e\n    )\n  }\n\n  handleFiles = (files, images) =\u003e {\n    this.setState({\n      files,\n      images\n    })\n  }\n}\n\nexport default App;\n```\n\n\u003e **NOTE**: The `onFiles` callback prop is slightly different when `multiple` is `true`. Instead of a `File` and an encoded string, you will receive array of `Files` and array of encoded strings.\n\n### Reacting to dropped files\nBy default, `Uploadi` reacts to dropped files. In order to display something when something is being dragged over to `Uploadi`, you may use the `over` property provided to the render prop like so:\n\n```js\nclass App extends React.Component {\n  render() {\n    return (\n      \u003cUploadi multiple onFiles={this.handleFiles}\u003e\n        {({over, onSelect}) =\u003e (\n          \u003cdiv\u003e\n            {over \u0026\u0026 (\n              \u003cdiv className=\"drop-overlay\" /\u003e\n            )}\n          \u003c/div\u003e\n        )}\n      \u003c/Uploadi\u003e\n    )\n  }\n\n  handleFiles = (files, images) =\u003e {\n    //\n  }\n}\n\nexport default App;\n```\n\n\u003e **NOTE**: The `onFiles` callback prop is slightly different when `multiple` is `true`. Instead of a `File` and an encoded string, you will receive array of `Files` and array of encoded strings.\n\n## API Documentation\nHere's a list of props you may use to customize the component for your use-case:\n\n| Parameter  | Type | Description |\n| ----- | ---- | ----------- |\n| multiple | `boolean` | Enable multiple files to be selected. Defaults to `false`. |\n| accept | `string` | Files types you'd like to be selected. |\n| onFiles | `function(File file, string img)` (required) | Callback called when a file is selected. |\n| onFiles | `function(Array\u003cFile\u003e files, Array\u003cstring\u003e img)` (required) | Callback called when `multiple` is `true`. |\n\n## Setup\nYou can check the [demo](https://react-uploadi.kierb.com/), or build it yourself locally:\n\n```bash\nnpm install\nnpm run start\n```\n\nAfterwards, open up `localhost:9001` in your browser.\n\n### Bundling package\n```\nnpm run bundle\n```\n\n### Publish storybook\n```\nnpm run storybook:publish\n```\n\n## Attribution\nBig thanks to [Pavlo Tyshchuk](https://dribbble.com/pavlotyschuk) for his [Free User pics](https://dribbble.com/shots/1938508-Free-User-pics) used in the examples.\n\n## Alternatives\n- [@navjobs/upload](https://github.com/navjobs/upload)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrph%2Freact-uploadi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrph%2Freact-uploadi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrph%2Freact-uploadi/lists"}