Upload image to Azure blob storage from Windows Phone. Not creating

萝らか妹 提交于 2019-12-04 15:22:00

I have an application (Windows Phone 8) that uploads an image taken to an Azure webrole, which in turn stores the image in an Azure Storage Blob. The code below is how the server stores the images. Again, this code does not run on the phone, but you can use it as a reference.

                string randomGUID = locationID
                + "-"
                + Guid.NewGuid().ToString();

            //Retrieve storage account from application settings
            CloudStorageAccount storageAccount = GetStorageAccount();

            //Create blob client
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            //Retrieve reference to images container
            CloudBlobContainer container = blobClient.GetContainerReference(
                RoleEnvironment.GetConfigurationSettingValue("BlobContainer"));                    

            //Retrieve references to the blob inside the container
            CloudBlockBlob blockBlob = container.GetBlockBlobReference(randomGUID);

            blockBlob.UploadFromStream(imageToUpload);

The variable imageToUpload is of the type Stream.

As you can see, this is pretty straightforward code. Perhaps your problem has to do with the lambda expression you have in UploadFromStream?

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