Using CloudUpload / Retrieving Files for Attachments

2 posts, 0 answers
  1. Richard
    Richard avatar
    18 posts
    Member since:
    Sep 2011

    Posted 13 Nov 2014 Link to this post

    I'm writing a page that requires me to upload the file to the Azure for the purposes of keeping an archive.  So I have the upload working but I can't seem to figure out how to access the files.  So I have this to loop through after the upload and attach it to an e-mail notification.

    //Attachments
    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"].ToString());
    CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
    CloudBlobContainer container = blobClient.GetContainerReference("sitedata");
    foreach (Telerik.Web.UI.CloudUploadFileInfo file in RadCloudUpload1.UploadedFiles)
    {
    CloudBlockBlob blockBlob = container.GetBlockBlobReference(file.KeyName);
    Stream mem = new MemoryStream();
    blockBlob.DownloadToStream(mem);
    MAttach = new System.Net.Mail.Attachment(mem, file.OriginalFileName);
    msg.Attachments.Add(MAttach);
    }

    I'm getting 0k attachments.  Any suggestions or thoughts?

    Thanks,

    Richard
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 18 Nov 2014 Link to this post

    Hi Richard,

    Why don't you provide a link for direct downloading:

    http://test.blob.core.windows.net/blobname/photo.jpg

    Regards,
    Hristo Valyavicharski
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top