This is a migrated thread and some comments may be shown as answers.

Using CloudUpload / Retrieving Files for Attachments

1 Answer 24 Views
CloudUpload
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Veteran
Richard asked on 14 Nov 2014, 04:20 AM
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

1 Answer, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 18 Nov 2014, 03:53 PM
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.

 
Tags
CloudUpload
Asked by
Richard
Top achievements
Rank 1
Veteran
Answers by
Hristo Valyavicharski
Telerik team
Share this question
or