2回答
- 新しい順
- 投票が多い順
- コメントが多い順
1
Hello.
I set "acl: "public-read"" when uploading the object, but I don't think the S3 bucket allows "public-read" by default.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/acls.html
ACL must be enabled to allow "public-read".
https://repost.aws/knowledge-center/read-access-objects-s3-bucket
I thought that if you don't need to use "public-read", you can upload by setting "acl" to "private".
https://www.npmjs.com/package/multer-s3
1
Maybe you can use req.file.key
to reference the file stored in S3:
const newDoc = await Model.create({ title: req.body.title, file: req.file.key, // your forgot to use req.file.key (The name of the file) });
Sources:
関連するコンテンツ
- AWS公式更新しました 2年前
- AWS公式更新しました 3年前