Amazon S3 upload with public permissions

前端 未结 5 1720
再見小時候
再見小時候 2021-02-01 03:15

I\'m using the Amazon C# SDK and trying to upload a file, but by default it has restricted permissions. I would like to make it publicly available, but I can\'t seem to find ou

5条回答
  •  迷失自我
    2021-02-01 03:58

    You can use the property CannedACL of Amazon.S3.Model.PutObjectRequest to upload files to S3 as shown below,

     var putObjectRequest = new Amazon.S3.Model.PutObjectRequest
                            {
                                BucketName = bucketName,
                                Key = key,
                                CannedACL = S3CannedACL.PublicReadWrite
                            }; 
    

提交回复
热议问题