How do I client-side upload a viewable file to Amazon S3?

前端 未结 7 1357
别那么骄傲
别那么骄傲 2020-12-13 15:20

Let me start of by saying that I am normally very reluctant to post this questions as I always feel that there\'s an answer to everything SOMEWHERE on the internet. After sp

7条回答
  •  执笔经年
    2020-12-13 16:13

    Are you using the official AWS Node.js SDK? http://aws.amazon.com/sdkfornodejs/

    Here's how I'm using it...

     var data = {
            Bucket: "bucket-xyz",
            Key: "uploads/" + filename,
            Body: buffer,
            ACL: "public-read",
            ContentType: mime.lookup(filename)
        };
     s3.putObject(data, callback);
    

    And My uploaded files are public readable. Hope it helps.

提交回复
热议问题