Amazon S3 File Upload Api C
‘MethodNotAllowed’ error up if the resource you are trying to access does not have the relevant permissions. It could be because of incorrect bucket name. Well here are the instruction that you have to follow to get a fully working demo program. 1-Download and install the Amazon web services SDK for.NET which you can find in (because I have visual studio 2010 I choose to install the 3.5.NET SDK. 2- open visual studio.
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 out how to do it as part of the upload.
My bucket is public, but when I upload a new file using the code below, the file I upload is not public.
Has anyone had to do this before?
MattoToddMattoTodd5 Answers
The solution by Tahbaza is correct, but it doesn't work in the later versions of AWS SDK (2.1+)...
Consider using the following for 2.1+ versions of SDK:
Web Api File Upload
Found it, need to use a TransferUtilityUploadRequest
:
I have done this before, and in C#, but not with your library (so this may be of limited help).
The idea is to send an ACL header along with the file.
S3 File Upload
This is one way to do it that should point you in the right direction.
Here's also a link to some relevant AWS docs.
TahbazaTahbazaGoogle Drive
Consider CannedACL approach, shown in the follwing snippet:
You can use the property CannedACL of Amazon.S3.Model.PutObjectRequest to upload files to S3 as shown below,