0.1.6 • Published 10 years ago

react-s3-upload v0.1.6

Weekly downloads
3
License
MIT
Repository
github
Last release
10 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

10 years ago

0.1.5

10 years ago

0.1.42

10 years ago

0.1.41

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.5

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago