Last post Apr 14, 2011 04:05 PM by Diomedes
Mar 07, 2011 01:16 PM|bradoyler|LINK
If anyone just started using MVC in the cloud (Windows Azure or AppHarbor) they will probably realize quickly that they are not allowed to use local storage for images. So, I thought I'd post a quick example that would help get peeps started with solving
this problem. One solutions is to use Amazon's S3 service, which is pretty simple.
Here's the markup and required C# code to put into your ActionResult:
<input type=”file” id=”fileUpload” name=”fileUpload” size=”23” />
HttpPostedFileBase file = Request.Files;
if (file.ContentLength > 0) // accept the file
string accessKey = "XXXXXXXXXXX";
string secretKey = "122334XXXXXXXXXX";
using (client = Amazon.AWSClientFactory.CreateAmazonS3Client(accessKey, secretKey))
MemoryStream ms = new MemoryStream();
PutObjectRequest request = new PutObjectRequest();
.WithKey("meals/test.jpg").InputStream = file.InputStream;
S3Response response = client.PutObject(request);
More detail is available here:
I'd like to know what others are using for this scenario in MVC. Thanks.
Apr 14, 2011 04:05 PM|Diomedes|LINK
Thanks for posting. I tried to translate this into vb but I can't get it to work. Any help will be greatly appreciated.