Azure - is one 'block blob' seen as one file?

1.3k views Asked by At

Question background:

This may be a simple question but I cant find an answer to it. I've just started using Azure storage (for storing images) and want to know if one 'blob' holds a maximum of one file?

This is my container called fmfcpics:

enter image description here

Within the container I have a block blob named myBlob and within this I have one image:

enter image description here

Through the following code, if I upload another image file to the myBlob block blob then it overwrites the image already in there:

 CloudBlockBlob blockBlob = container.GetBlockBlobReference("myblob");


        using (var fileStream = System.IO.File.OpenRead(@"C:\Users\Me\Pictures\Image1.jpg"))
        {
            blockBlob.UploadFromStream(fileStream);
        }

Is this overwriting correct? Or should I be able to store multiple files at the myBlob?

2

There are 2 answers

2
David Makogon On BEST ANSWER

Each blob is a completely separate entity, direct-addressable via uri:

http(s)://storageaccountname.blob.core.windows.net/containername/blobname

If you want to manage multiple entities (such as image jpg's in your case), you would upload each one to a separate blob name (and you're free to store as many as you want within a single container, and you may have as many containers as you want).

Note: These are block blobs. There are also page blobs that have random-access capability, and this is the basis for vhd storage (and in that case, the vhd would have a formatted file system within it, with multiple files).

0
Enrico Tirotta On

In blob Azure Documentation you understand how blob service works and the concepts about this storage service.

In some minutes you can use the service easily