I'm getting started with Azure File Services and I'm having a 'duh' moment; I'm missing something obvious.
I figured out the API, created a share and uploaded an image from the .net API (not REST API).
the url
http://cooperwrite.file.core.windows.net/cwfiles/me.jpg
is a picture of me. I thought (but am clearly wrong) that this url is also the public url that I would use to render the image.
When I try to access it I get an error. I'm guessing that this url is used to access the file for the purposes of the REST API, but how do I get the url that I would put into an tag?
This issue has the feel of a protection issue but I can't find any dials to turn.
Thanks,
john
Short answer is that you can't.
Essentially for you to display the image using img tag, your browser should access the resource anonymously. Currently all requests to file service resources must be authorized (using either SharedKey or ShareKeyLite authorization scheme) hence you can't access a resource in file service only by specifying a URL.
Your best bet at this time would be to make use of Azure Blob Storage and save the file in a container with either Blob or Public ACL. If your blob container's ACL is private, then you would need a Shared Access Signature (SAS) with Read permission on the image (SAS Token needs to be included in the URL in that case) to be displayed directly in the browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With