3

I am trying to use Azure Blob Storage as a location for secure file downloads using Shared Access Signature. Everything is working very well, however the problem I am having is I am trying to allow the user to save files from the browser and I have all browsers except IE9 working.

Reviewing this question,

What content type to force download of text response?

this works well when I can control all of the headers, however in Azure Blob Storage, I have set the Content-Type to application/octet-stream and this allows all browsers except IE to ask the user to save the file, IE simply opens the file. It appears that known file types will open (example .jpg, .wmv etc…).

In Azure, I have found no way to set

Content-Disposition: attachment;filename="My Text File.txt"

Is there a way, using Azure Blob Storage, to use IE to download any file directly from Azure Blob Storage?

Thanks in advance.

Community
  • 1
  • 1
Jason Lavigne
  • 459
  • 5
  • 12

3 Answers3

2

I don't think there's a way to set the Content-Disposition header in Windows Azure blob storage.

user94559
  • 59,196
  • 6
  • 103
  • 103
1

You can now by right clicking the resource - properties.

Nimz
  • 23
  • 7
0

If you're using the @azure/storage-blob package for uploading blobs with SAS, you can force the file to be downloaded by setting the Content Disposition as shown below.

In the following example, a *.png image file is downloaded when linked to rather than the browser default of opening in a new tab:

blockBlobClient.upload(file.content, file.size, {
    blobHTTPHeaders: {
        blobContentType: "image/png",
        blobContentDisposition: "attachment"
    }
});
Joe Coyle
  • 601
  • 6
  • 15