简体   繁体   中英

Ajax control toolkit AsyncFileUpload file upload contol on azure

Did any one implemented multi File attach and Upload functionality - asp.net web application on azure .

I am looking for a sample implementation AsyncFileUpload control with azure (asp.net C# web application on azure) ?

protected void btnClick_Click(object sender, EventArgs e)
{
     if (AsyncFileUpload1.HasFile)
     {
         AsyncFileUpload1.SaveAs(@"C:\Upload Files\" + AsyncFileUpload1.PostedFile.FileName);
     }
}

How to save to azure blob ?

protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)

{

        CloudBlobContainer cont = client.GetContainerReference("Your containerName");          
        var stream = e.GetStreamContents(); // get streams of data from AjaxFileUpload control
        CloudBlockBlob cblob = cont.GetBlockBlobReference("Blob reference name");
        cblob.UploadFromStream(stream); //upload file on Azure Storage

}

There are some fine articles on Internet. I will like you to know that uploading large files on windows azure isn't that simple. I used silverlight for that purpose. I suggest you also to use some client side technology instead of ASP.NET upload control or Ajax Upload Control. Anyhow you can upload files using ASP.NET File Upload control or Ajax Upload Control. And I don't thing you can use SaveAs method to upload file on Windows Azure. Convert the file into stream and then upload. I am sharing some good links. Study them.

http://www.codeproject.com/Articles/83481/Windows-Azure-Storage http://blog.smarx.com/posts/uploading-windows-azure-blobs-from-silverlight-part-1-shared-access-signatures http://www.windowsazure.com/en-us/develop/net/how-to-guides/blob-storage/

Yes , I also use silverlight multi file uploader. Its provide best way to upload multiple file with client side validation on file type and file size etc.Also we can easily show progress bar(Uploading) in silverlight.

see this link.

http://silverlightfileupld.codeplex.com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM