Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Azure Blob file size

I used Azure blob to store images. Users upload those images. I want to see how much space each user occupy with their images. How can I do that in ASP.NET code behind? Can I get an image file size just by knowing its URI? Or do I need use some blob related function?

like image 458
martial Avatar asked Aug 13 '14 08:08

martial


1 Answers

You need to fetch a blob's properties first. Eg,

var blob = _container.GetBlockBlobReference(blobName); if (blob.Exists()) {     blob.FetchAttributes();     return blob.Properties.Length; }  throw new Exception("Blob doesn't exist"); 
like image 92
Steve Owen Avatar answered Oct 16 '22 17:10

Steve Owen