Azure Blob’s Ghost Folders?

This week I had to address a upload image to blob application that I had built in my development environment, was working fine, but needed to be configured to work in production.  For the application overall, I used Azure Samples for Upload Image to Storage (built in .NET Core).  In it, the configuration in appsettings.json looks like this:

"AzureStorageConfig": {
    "AccountName": "",
    "AccountKey": "",
    "ImageContainer": "images",
    "ThumbnailContainer": "thumbnails"
}

 

Account Name account name and AccountKey are easily found in Azure Portal, for container I used Azure Storage Explorer just so I could get a full look at the container and its blobs.  The problem was, in my development environment I was uploading DIRECTLY to container.  In the example above, I was uploading to the “images” container.  In my Production environment, though, my ImagesContainer had two folders:  images/small and images/large.  I tried to change the “ImagesContainer”:”images” to “ImagesContainer”:”images/small”, “ImagesContainer”:”images\small” and no go.  Requested URI not found.

The problem? The folder you see are not actual folders, consider them sort of part of the file name with a folder delimiter of \,  meaning you add the folder name to the front of the file name.  Example, the correct answer is:  “ImagesContainer”:”images”  but, when I specify the file name in my code to upload, it would be “small\mypic.jpg”.  This would direct the file to the images container and the file name would direct it under what folder and file name to store it.   Storage is a bit odd sometimes with its hierarchy and case-sensitive behaviour, but once you are aware, quite easy to accommodate.

Also, a quickie:  no leading “\” on that filename.  Simply it should be:  “small\mypic.jpg”

You may also like