0.1.6 • Published 8 years ago

react-s3-upload v0.1.6

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

react-s3-upload

This library allows you to very easily upload files from a react application to Amazon S3, using express for authing with S3 and signing.

The component is completely stateless, so while it functions as a React component, there's no dependency on the React framework for this package.

Actually, this package has no hard dependencies - it does, however, assume you have aws-sdk configured on your express server.

Library was created following the tutorial available on Heroku - https://devcenter.heroku.com/articles/s3-upload-node

  • Embed the react component in your application
  • Set up your express server
  • Magic

Installation

$ npm install react-s3-upload

React Component

import ReactUpload from 'react-s3-upload';

<ReactUpload 
  onProgress={ (pct) => { console.log(pct) } }
  onComplete={ (url) => { console.log(url) } }
  folder="uploads" />
  • onProgress - callback function for XHR onprogress.
  • onComplete - callback function when upload is done.
  • folder - optional folder in your bucket where the file will be uploaded to.

Server-Side

 app.get('/sign_s3', require('react-s3-upload/S3Sign')({
    S3_BUCKET:'your_bucket', 
    unique: false
  }));
  • unique - optional generate a unique filename for your upload or not.
  • S3_BUCKET - the name of your Amazon S3 bucket.
0.1.6

8 years ago

0.1.5

8 years ago

0.1.42

8 years ago

0.1.41

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.5

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago