title: Upload a file to S3 bucket's folder using ASP.NET SDK
body: <p>How do I use AWS SDK for ASP.NET to upload a file to a specific folder? - I was able to upload files by specifying the bucket name (request.WithBucketName), but I want to be able to upload a file to a specific folder within the bucket itself.</p>
  
  <p>This is the code that I use to upload a file to a single bucket:</p>
  
  <pre><code>public bool UploadFileToS3(string uploadAsFileName, Stream ImageStream, S3CannedACL filePermission, S3StorageClass storageType, string toWhichBucketName)
  {
  
      try
      {
          client = Amazon.AWSClientFactory.CreateAmazonS3Client(MY_AWS_ACCESS_KEY_ID, MY_AWS_SECRET_KEY);
          PutObjectRequest request = new PutObjectRequest();
          request.WithKey(uploadAsFileName);
          request.WithInputStream(ImageStream);
          request.WithBucketName(toWhichBucketName);
          request.CannedACL = filePermission;
          request.StorageClass = storageType;
  
          client.PutObject(request);
          client.Dispose();
      }
      catch
      {            
          return false;
      }
      return true;
  
  }
  </code></pre>
  
  <p>Hope that this code will help you out.</p>