Download from Azure storage in html link

試著忘記壹切 提交于 2020-01-15 02:45:08

问题


So I have a file uploaded to my azure storage and have a simple anchor tag where a user should be able to simply download the file. This is not working and not understanding why.

My code:

<a href="https://cembsite.file.core.windows.net/cembapphandouts/IsraelHandouts/Solution Interview Worksheet.pptx">Get Worksheet Here!</a>

When you click on the link to download, it takes to an error saying invalid http header. This is a simple powerpoint file. If I go to the file properties within Azure, I can click download and it does fine.

Any thoughts to how I can resolve this?


回答1:


Your URL is pointing to Azure File storage, which is not quite the same as raw blobs. That is, you cannot just access individual files within the Azure File store without proper authentication (e.g. mounting the smb volume, using the API, Shared Access Signature, etc), even though File Storage is backed by blob storage.

If you truly stored the object in a blob (vs File Storage), then the url should look something like:

https://cembsite.blob.core.windows.net/containername/filename.pptx

Notice the URL contains blob vs file.



来源:https://stackoverflow.com/questions/40917730/download-from-azure-storage-in-html-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!