# S3

#### 1 - Create s3 bucket <a href="#id-2-create-s3-bucket" id="id-2-create-s3-bucket"></a>

Follow this useful guide [https://github.com/keithweaver/python-aws-s3​](https://github.com/keithweaver/python-aws-s3)

![](https://1684234023-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LY13uPlo20E7hNPj1d2%2F-L_ZMK23vRv3uYD76Suv%2F-L_ZMMpaKxO1OeFpmtaz%2F1.gif?alt=media\&token=eb808a0a-fe8f-4d39-83af-1da73652658f)

![](https://1684234023-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LY13uPlo20E7hNPj1d2%2F-L_ZMK23vRv3uYD76Suv%2F-L_ZMQYoNfYfks710G4h%2F2.gif?alt=media\&token=ccef5aea-4efa-4e41-b95d-a57d4ac15fc7)

#### 2- Update config file <a href="#id-3-update-config-file" id="id-3-update-config-file"></a>

/config/default.json

![](https://1684234023-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LY13uPlo20E7hNPj1d2%2F-LYDykAdhUUS4mw-D67n%2F-LYE1tDM-aaNjtFOcbYg%2FAnnotation%202019-02-08%20233721.jpg?alt=media\&token=5c743b7e-1881-481b-a0af-3ebd329e887a)

### How to upload file with [feathers client](https://docs.feathersjs.com/api/authentication/client.html)

Copy this yo your client app-

```javascript
const axios = require("axios");
const app = feathers();
const restClient = rest("http://localhost:3030");
app.configure(restClient.axios(axios));

// Available options are listed in the "Options" section
app.configure(
  auth({
    header: "Authorization", // the default authorization header for REST
    prefix: "", // if set will add a prefix to the header value. for example if prefix was 'JWT' then the header would be 'Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOi...'
    path: "/authentication", // the server-side authentication service path
    jwtStrategy: "jwt", // the name of the JWT authentication strategy
    entity: "user", // the entity you are authenticating (ie. a users)
    service: "users", // the service to look up the entity
    cookie: "feathers-jwt", // the name of the cookie to parse the JWT from when cookies are enabled server side
    storageKey: "feathers-jwt", // the key to store the accessToken in localstorage or AsyncStorage on React Native
    storage: cookieStorage // Passing a WebStorage-compatible object to enable automatic storage on the client.
  })
);
  
  //Upload to S3
  const upload = (acceptedFiles, rejectedFiles) => {
    var formData = new FormData();
    formData.append("file", acceptedFiles[0], "chris.jpg");
    app
      .service("uploads")
      .create(formData, {
        headers: {
          "content-type": "multipart/form-data"
        }
      })
      .then(res => {
        alert("upload ends");
      })
      .catch(err => {
        alert(err.message);
      });
  };
  
  //Upload to local
  const upload = (acceptedFiles, rejectedFiles) => {
    var formData = new FormData();
    formData.append("file", acceptedFiles[0], "chris.jpg");
    app
      .service("uploads-static")
      .create(formData, {
        headers: {
          "content-type": "multipart/form-data"
        }
      })
      .then(res => {
        alert("upload ends");
      })
      .catch(err => {
        alert(err.message);
      });
  };
```

```
```
