Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blueberryapps/redux-file-upload
Redux-friendly file upload made easy
https://github.com/blueberryapps/redux-file-upload
blueberry-opensource file-upload react redux
Last synced: about 7 hours ago
JSON representation
Redux-friendly file upload made easy
- Host: GitHub
- URL: https://github.com/blueberryapps/redux-file-upload
- Owner: blueberryapps
- License: mit
- Created: 2016-05-18T08:38:02.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-02-10T02:29:08.000Z (over 1 year ago)
- Last Synced: 2024-08-22T18:14:18.606Z (3 months ago)
- Topics: blueberry-opensource, file-upload, react, redux
- Language: JavaScript
- Homepage:
- Size: 407 KB
- Stars: 65
- Watchers: 28
- Forks: 17
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# redux-file-upload [![Dependency Status](https://dependencyci.com/github/blueberryapps/redux-file-upload/badge)](https://dependencyci.com/github/blueberryapps/redux-file-upload)
# Motivation
There aren't any simple yet customizable file uploader packages that would work nicely with Redux. redux-file-upload is here to fill the gap!# Install
`npm install --save redux-file-upload`Please note - a middleware that passes `dispatch` to actions, e.g. redux-thunk, redux-promise-middleware, is required for this package to work properly.
# API
The package exposes the following:- `actions` - you can use these to implement your own custom logic if you need (e.g. add more dropzones for a single uploader). Check the source code to see what actions are available.
- `reducer` - add this to your composed reducer.
- `FileUpload` - the main component (see its API below).
- `UploadingDocument` - an immutable record representing the way a generic document is represented in store.
- `UploadingImage` - an immutable record representing the way an image is represented in store.# FileUpload API
Below are the props you can pass to the file upload component.## `allowedFileTypes`
An array with filetypes that can be uploaded using the file upload. There are several that will be recognized automatically as images (jpg, jpeg, png, gif, tiff).## `className`
The component will be wrapped in a div with this class.## `data`
Object with any additional data that will be sent along with the files to the endpoint.## `dropzoneActiveStyle`
Style used when user hovers over the dropzone.## `dropzoneId` (required)
Each file uploader on the package needs a unique ID. This value is also used as an identifier in the reducer unless the `identifier` prop is specified (see below).## `identifier`
If specified, uploaded files will be organized in the store using this value. Specifying the same value for multiple file upload components allows you to have multiple dropzones for the same file upload on one page.## `multiple`
Specifies whether the file upload allows more than one file being added at one time.## `url` (required)
The URL to which the files will be POSTed.You can also pass something as children to the component (for example an upload button).
# Example
```jsx
import { FileUpload } from 'redux-file-upload'
Click or drag here
```
# Browser compatibility
The component should work in all modern browsers including IE11+.# License
MIT 2016## Made with love by
[![](https://camo.githubusercontent.com/d88ee6842f3ff2be96d11488aa0d878793aa67cd/68747470733a2f2f7777772e676f6f676c652e636f6d2f612f626c75656265727279617070732e636f6d2f696d616765732f6c6f676f2e676966)](https://www.blueberry.io)