Uploading a picture to Windows Azure blob storage

谁说胖子不能爱 提交于 2019-12-24 16:52:33

问题


I'm trying to upload a picture to Windows Azure blob storage. I found a good example, but it relied on the Microsoft.WindowsAzure.StorageClient assembly. I've just learned that the latest version of the Windows Azure SDK has a new Microsoft.WindowsAzure.Storage assembly, which replaces the older StorageClient assembly. This new assembly uses new concreate types: CloudPageBlob and CloudBlockBlob. With the new assembly, I used the following:

// Setup the blob
string blobAddress = "myPicture.png";
CloudBlob blob = container.GetBlobReference(blobAddress);
blob.Properties.ContentType = "image/png";

With the new assembly though, I'm not sure what to use. If I'm uploading an image into blob storage, is it a page blob or a block blob? I don't understand the difference between the two. At the same time, I can't find information about the difference between the two. Can someone please help me out?


回答1:


Old library's CloudBlob.Upload* methods upload to block blobs. Hence, when updating your application to use the new library, you can use a CloudBlockBlob instead.

For more information on block blobs and page blobs, please refer to Understanding Block Blobs and Page Blobs.



来源:https://stackoverflow.com/questions/14442691/uploading-a-picture-to-windows-azure-blob-storage

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