1.1.2 • Published 9 years ago

react-s3bucket-upload v1.1.2

Weekly downloads
1
License
ISC
Repository
-
Last release
9 years ago

react-s3bucket-upload

A react function for uploading images to amazon s3 bucket

Deps

##Usage

import uploadImage from "react-s3bucket-upload";

await uploadImage(this,
        `/api/images`, 
        imageFile,
        this.onReceiveDefaultUrls,
        this.onFailImageLoading
      );

###Parameters The first parameter `(/api/images)`- This is an endpoint which signs the request to s3, It's an endpoint on your end to return such things as signature, policy, bucket....etc

  const {
    signature,
    policy,
    date,
    bucket,
    accessKeyID,
    region,
    urls
  } = (await axios.get(`http://localhost:7000/api/images/${uiqueUUID}/signature?type=${type}`)).data;
  where uiqueUUID is a unique uuid generated from this module

imageFile - This is an object of the image selected, which contains, files name, datetime....

onReceiveDefaultUrls(function) - This returns the urls to the images uploaded to s3 bucket amazon

For example
 onReceiveDefaultUrls(formats) {
    //set whatever state once urls are returned.
 }

onFailImageLoading(function) - If an error occures, it recives the error message and sends it back

For example
  onFailImageLoading(error) {
    //display error message
  }
1.1.2

9 years ago

1.1.1

9 years ago

1.0.18

9 years ago

1.0.17

9 years ago

1.0.16

9 years ago

1.0.15

9 years ago

1.0.14

9 years ago

1.0.13

9 years ago

1.0.12

9 years ago

1.0.11

9 years ago

1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago