Seenu Seenu - 1 year ago 143
Javascript Question

Upload Largefile to Azure Blob using Javascript

I have seen few examples where a file is transferred to server side and then uploaded to Azure Blob Storage.

But I have files with size in few GBs.

Is there a way I can upload a file directly to Azure Blob Storage using Client Side scripts instead of doing it from Server Side to save time.

Answer Source

Updating my answer, now that CORS is supported in Windows Azure Storage and the OP has not accepted any answer :).

Yes, it is possible to upload large files directly from your browser to Windows Azure Storage. You may find these steps useful:

  1. First create a Shared Access Signature URL (SAS) with at least Write permission on the blob container in which you wish to upload the files. Since you're uploading large files, I would recommend keeping SAS expiry time to be long enough.

  2. Next enable CORS on your storage account. If you wish to do it programmatically, you may find this post useful: If you want to use a tool, my company has released a Free tool to do just that. You can read more about this tool and download from here:

  3. I wrote a blog post some time back on uploading very large files into blob storage which you can read here: Once CORS is enabled on your storage account, code mentioned in the blog should work just fine.

Actually there's a way though there are some preconditions/caveats.
  1. Because CORS is not supported in Blob Storage just yet, your HTML and JS file need to be present in same blob storage account. They should be in a public blob container.
  2. Since you're uploading large files, they would need to be split into chunks less than 4 MB in size. HTML 5 has a File API which can split the file into chunks but not all browsers support this feature.
I wrote a blog post some time ago about uploading large files using pure JavaScript and Shared Access Signature. You can read that post here: