After storing a digital file
in Azure blob storage
, I want to provide a link
to that file in my static website
(that has no
server side code). When a user clicks on that link user should be able to download that digital file to his/her computer. Question: How do you get the url
of a digital file stored in Azure blob storage?
How to get download url of a digital file stored in an Azure storage account
Asked Answered
You mean something like account.blob.core.windows.net/container-name/digital-file-name? –
Contravene
@GauravMantri A URL of my digital file in Azure blob storage that - when a user clicks on - should immediately download the digital file to his/her computer (download folder). User's browser would of course give a warning if you want to download this file - but that is off topic here. –
Morissa
Provided an answer. Not sure if this is what you're looking for. HTH. –
Contravene
Each blob in Azure Storage has a URL of the following format:
https://account.blob.core.windows.net/container/blob
Where:
account
is the name of your storage account, container
is the name of your blob containerand
blob` is the name of your blob.
Now that your requirement is that a user should be prompted to download the file directly without using any server-side code, these are the additional things you would need to do:
- Make sure that the blob container's ACL is either set to
Blob
(recommended) orPublic
. If you set the ACL toPrivate
, then you would need aShared Access Signature (SAS)
and that would require some server-side code. - Either set the
content-type
of the blob toapplication/octet-stream
(default content type for any blob in Azure Storage) or set thecontent-disposition
property toattachment; filename="your file name"
to force the file download instead of displaying it inside the browser only. Recommended approach is to usecontent-disposition
property.
© 2022 - 2024 — McMap. All rights reserved.