1.1.2 • Published 8 years ago

react-s3bucket-upload v1.1.2

Weekly downloads
1
License
ISC
Repository
-
Last release
8 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

8 years ago

1.1.1

8 years ago

1.0.18

8 years ago

1.0.17

8 years ago

1.0.16

8 years ago

1.0.15

8 years ago

1.0.14

8 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago