Problem uploading to Blob storage RRS feed

  • Question

  • hello all!

    take a look at the following code:

    if (photoStream == Stream.Null || photoStream.Length == 0)
                    return null;
                CloudBlobClient cli = new CloudBlobClient("http://myStorage.blob.core.windows.net/", new StorageCredentialsAccountAndKey(ConfigurationManager.AppSettings["azureStorageAccount"], ConfigurationManager.AppSettings["azureStorageAccountKey"]));
                CloudBlobContainer container = null;
                string fileName = "";
                switch (ownerType)
                    case PhotoOwnerType.User:
                        container = cli.GetContainerReference("userblobs");
                        fileName = string.Format("{0}/{1}", ownerID, Guid.NewGuid().ToString("N") + ".png");
                    case PhotoOwnerType.System:
                        container = cli.GetContainerReference("daange");
                        fileName = string.Format("{0}", Guid.NewGuid().ToString("N") + ".png");
                CloudBlob blob = container.GetBlobReference(fileName);
                return fileName.ToLower();

    it uploads a stream (that always is a image... thrust me on that one) to a blob... and it does not throw any error or exeception... but if get the uri of the blob and navigate to it, it returns me a blank page... like if the contents of the blob is zero...

    can anyone help???


    I just checked... after blob.UploadFromStream() the blob.Properties.Lenght=0!!!! but the photo stream is not zero!!! seems like its not uploading...

    Sunday, August 26, 2012 3:33 PM


  • Figured it out... the STREAMPOSITION was set to the end of the stream... stream.Position=0 fixed it...
    Sunday, August 26, 2012 3:49 PM