title: Upload file to Amazon S3 with non default permission
body: <p>I'm trying to upload a file to Amazon S3 using .NET SDK. The upload works fine, except it is applying the <a href="http://docs.aws.amazon.com/sdkfornet/latest/apidocs/html/T_Amazon_S3_Model_S3CannedACL.htm" rel="nofollow">default permission</a> to the uploaded file, which is 'Private'.</p>
  
  <p>I'd like the permission on the uploaded files to be set to 'BucketOwnerFullControl'.</p>
  
  <p>Below is my code, and I'm not quite sure what I need to do to it to get it working as such.</p>
  
  <pre><code>    static string accessKeyID = "";
      static string secretAccessKey = "";
      static string existingBucketName = "bucket";
  
      static void Main(string[] args)
      {
          NameValueCollection appConfig = ConfigurationManager.AppSettings;
          accessKeyID = appConfig["accesskey"];
          secretAccessKey = appConfig["secretkey"];
  
          string[] files = Directory.GetFiles("C:\\amazontestdirectory");
  
              foreach (string fileName in files)
              {
                  try
                  {
                      TransferUtility fileTransferUtility = new TransferUtility(accessKeyID, secretAccessKey);
  
                      // Upload a file, file name is used as the object key name.
                      fileTransferUtility.Upload(fileName, existingBucketName);
                  }
                  catch (AmazonS3Exception s3Exception)
                  {
                      Console.WriteLine("AWS error: " + s3Exception.Message, s3Exception.InnerException);
  
                      //Open a file for writing
                      string errorOutputFileName = System.IO.Path.GetFullPath("C:\\amazontestdirectory\\logs\\errorLog.txt");
  
                      //Get a StreamWriter class that can be used to write to the file
                      if (File.Exists(errorOutputFileName))
                      {
                          StreamWriter objStreamWriter;
                          objStreamWriter = File.AppendText(errorOutputFileName);
                          objStreamWriter.WriteLine();
                          objStreamWriter.WriteLine(DateTime.Now.ToString() + " - AWS error: " + s3Exception.Message, s3Exception.InnerException);
  
                          //Close the stream
                          objStreamWriter.Close();
                      }
                  }
              }
          }
  </code></pre>