.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Ajax >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

AsyncFileUpload Client Upload

Posted By:Sasi Prabhu       Posted Date: July 29, 2011    Points: 40    Category: Ajax    URL: http://www.dotnetspark.com  

Client Side Upload with Uploader Image.
 


AsyncFileUpload is an ASP.NET AJAX Control that allows you asynchronously upload files to server.
The file uploading results can be checked both in the server and client sides.

.aspx




   

       
 
 
 
 

      File Upload :
 

                UploaderStyle="Modern" ThrobberID="thodder"
          OnUploadedComplete="AsyncFileUpload1_UploadedComplete" OnUploadedFileError="AsyncFileUpload1_UploadedFileError" />
 

       
 
 
 
 

     Please Wait...
     Please Wait...

   

   




.aspx.cs
 protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
    {
        if (AsyncFileUpload1.HasFile)
        {
            string path = Server.MapPath("~/Files/" + AsyncFileUpload1.FileName);
            AsyncFileUpload1.SaveAs(path);
thodder.Text="File Uploaded.";
        }
    }

protected void AsyncFileUpload1_UploadedFileError(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
    {
thodder.Text="File Corrupted.";
        }







     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend