Before getting started Skill Level: Beginner Assumptions: You already gone through Parts 1-8 of Managing Amazon AWS with C#. Additional information: I sometimes cover small sub-topics in a post. Along with AWS, you will also be exposed to: Rhyous.SimpleArgs Step 1 – Alter the existing UploadFile method in BucketManager.cs We need the UploadFile method to take in a parameter that specifies the remote directory, which is the directory path on the S3 bucket. However, if no directory is specified, the key should simply be the file name. Edit file called BucketManager.cs. Enter this new method: Note: We are in luck, the TransferUtility object has an overload that takes in the key. public static async Task UploadFile(TransferUtility transferUtility, string bucketName, string file, string uploadLocation = null) { var key = Path.GetFileName(file); if (!string.IsNullOrWhiteSpace(uploadLocation)) { uploadLocation = uploadLocation.EndsWith("/") ? uploadLocation : uploadLocation + "/"; key = uploadLocation + key; } await Task.
I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.
Stay tuned to my blog, twitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.
Stay tuned to my blog, twitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.
This article is related to
AWS,csharp,aws,c#,S3
AWS,csharp,aws,c#,S3
No comments:
Post a Comment