Ron
Ron

Reputation: 1894

Upload File/s From Client To Azure Blob Storage | MVC

I have WebApp(MVC4) with a file upload and I did a terrible mistake, I let the client upload files to my server(Virtual Machine Azure) directly.

In order to do it, I set (in the WebConfig) :

  1. maxRequestLength="2097151"
  2. executionTimeout="3600"
  3. maxAllowedContentLength="4294967295"

Now I understand that its not the way to do it.

So what I want is to be able to upload the user files directly to my Azure Blob Storage without the files getting to my site.

I manage to upload files to my storage with C# butI don't want to send the files to the server-side and taking care of them there, because its mean that the files are first upload to the server then they move to the blob storage, and this is not good for me because I'm dealing with a very large files.

I need to transfer the files to the blob storage without going through the server.

How can I do it ? I didn't manage to find too many article addressing this issue, I just read about SAS and CORS that helping addressing the problem but without actual guidelines to follow.

Upvotes: 1

Views: 1451

Answers (1)

Serdar Ozler
Serdar Ozler

Reputation: 3802

You are right that CORS and SAS are the correct way to do this. I would recommend reading Create and Use a SAS with the Blob Service article for an introduction. Please also see our demo at Build 2014 for a sample application that lists and downloads blob in JavaScript using CORS and SAS.

Upvotes: 2

Related Questions