Skip to content

Commit 0b7330b

Browse files
committed
editing README.md
1 parent d1e6d49 commit 0b7330b

7 files changed

+59
-21
lines changed

README.md

+41-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ The `master` branch has the code for AWS-S3 upload and the `disk-storage` branch
88

99
First start mongodb service with `sudo service mongod start` and then the following commands
1010

11-
- Run `npm install`
12-
- Run `npm run dev`
13-
- Run `npm start`
11+
- Run `npm install`
12+
- Run `npm run dev`
13+
- Run `npm start`
1414

1515
It will start the server at [http://localhost:3000/](http://localhost:3000/)
1616

@@ -23,3 +23,41 @@ It will start the server at [http://localhost:3000/](http://localhost:3000/)
2323
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2424

2525
[NOTE ONLY FOR ME - I HAVE TO ENTER ALL DETAILS IN .env FILE AGAIN AS I HAVE DELETED THE S3-BUCKET ]
26+
27+
### How to make the AWS-S3 bucket public - whithout which the upload will NOT work
28+
29+
If you're using an Amazon S3 bucket to share files with anyone else, you'll first need to make those files public. Maybe you're sending download links to someone, or perhaps you're using S3 for static files for your website or as a content delivery network (CDN). But if you don't make the files public, your users will get an XML error message saying the file is unavailable.
30+
31+
1. Sign in to Amazon Web Services and go to your S3 Management Console.
32+
33+
2. Select the bucket from the left. At right, click the Properties button if it's not already expanded.
34+
35+
3. Go to the Permissions tab > Public Access Settings Tab
36+
37+
4. Click on Edit > Then
38+
39+
A) `Block new public ACLs and uploading public objects (Recommended)` - Make it false (i.e. uncheck it)
40+
41+
B) `Block new public bucket policies (Recommended)` - Make it false (i.e. uncheck it)
42+
43+
C) `Block public and cross-account access if bucket has public policies (Recommended)` - Make it false (i.e. uncheck it)
44+
45+
D) `Block public and cross-account access if bucket has public policies (Recommended)` - Make it false (i.e. uncheck it) - Without this last action, althouh I was able to upload BUT was NOT able to download.
46+
47+
So all the four options that was there (as on 24-Nov-2018) - I made all of them false.
48+
49+
#### I can test the upload API from Postman by selecting `http://localhost:3000/api/document/upload` and > POST > Body > form-data > under Key type "file" and under Value select file and choose a file.
50+
51+
And I will get back a 200 OK response of the below form-data
52+
53+
{
54+
"data": {
55+
"ETag": "a number",
56+
"Location": "full link of the file",
57+
"key": "original file name of the file that I uploaded",
58+
"Key": "original file name of the file that I uploaded",
59+
"Bucket": "my AWS s3 bucket name"
60+
}
61+
}
62+
63+
[Small note on .env file - When putting the value for "AWS_Uploaded_File_URL_LINK" - I have to include a forward slash ("/") after ]

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
"reactstrap": "^6.5.0"
2424
},
2525
"keywords": [
26-
"nodejs",
27-
"react",
28-
"mongodb",
29-
"multer",
30-
"aws-sdk",
31-
"AWS-S3"
32-
],
26+
"nodejs",
27+
"react",
28+
"mongodb",
29+
"multer",
30+
"aws-sdk",
31+
"AWS-S3"
32+
],
3333
"scripts": {
3434
"start": "react-scripts start",
3535
"build": "react-scripts build",
@@ -47,4 +47,4 @@
4747
"not ie <= 11",
4848
"not op_mini all"
4949
]
50-
}
50+
}

src/App.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import "./App.css";
33
import FileUpload from "./Components/FileUpload";
44

55
class App extends Component {
6-
render() {
7-
return (
8-
<div className="App">
9-
<FileUpload />
10-
</div>
11-
);
12-
}
6+
render() {
7+
return (
8+
<div className="App">
9+
<FileUpload />
10+
</div>
11+
);
12+
}
1313
}
1414

1515
export default App;

uploads/1542966806786-file.jpg

74.6 KB
Loading

uploads/1542966884672-file.jpg

74.6 KB
Loading

uploads/1542966912212-file.jpg

74.6 KB
Loading

0 commit comments

Comments
 (0)