Categories :-
Introduction:
Here I will explain how to use Ajax AsyncFileUpload control to upload files to folder and show progress bar during upload files to server using asp.net.If you want to upload file on the web server then you do not define the path it use virtual path of our folder only set the read and write permission on the folder.
Description : -
I will explain how to use ajax AsyncFileUpload control to upload files to folder in asp.net. Before proceed to implement sample have you install ajaxcontroltoolkit in visual studio or not if not install it otherwise if you already done then follow the below steps to implement Ajax AsyncFileUpload control example in asp.net.
If you observe above code I define lot of properties to ajax:AsyncFileUpload now I will explain all the
Introduction:
Here I will explain how to use Ajax AsyncFileUpload control to upload files to folder and show progress bar during upload files to server using asp.net.If you want to upload file on the web server then you do not define the path it use virtual path of our folder only set the read and write permission on the folder.
Description : -
I will explain how to use ajax AsyncFileUpload control to upload files to folder in asp.net. Before proceed to implement sample have you install ajaxcontroltoolkit in visual studio or not if not install it otherwise if you already done then follow the below steps to implement Ajax AsyncFileUpload control example in asp.net.
First create one new website after that right click on it add new folder and give name as ‘Files’ after that add AjaxControlToolkitreference to your application and add following line in your aspx page
<%@ Register Namespace="AjaxControlToolkit"Assembly="AjaxControlToolkit"tagPrefix="ajax"%>
Once add above references design your aspx page will be likes this
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Untitled Page</title> <script type="text/javascript"> // This function will execute after file uploaded successfully function uploadComplete() { document.getElementById('<%=lblMsg.ClientID %>').innerHTML = "File Uploaded Successfully"; } // This function will execute if file upload fails function uploadError() { document.getElementById('<%=lblMsg.ClientID %>').innerHTML = "File upload Failed."; } </script> </head> <body> <form id="form1" runat="server"> <ajax:ToolkitScriptManager ID="scriptManager1" runat="server"/> <div> <ajax:AsyncFileUpload ID="fileUpload1" OnClientUploadComplete="uploadComplete" OnClientUploadError="uploadError" CompleteBackColor="White" Width="350px" runat="server" UploaderStyle="Modern" UploadingBackColor="#CCFFFF" ThrobberID="imgLoad" OnUploadedComplete="fileUploadComplete" /><br /> <asp:Image ID="imgLoad" runat="server" ImageUrl="loading.gif" /> <br /> <asp:Label ID="lblMsg" runat="server" Text=""></asp:Label> </div> </form> </body> </html> |
If you observe above code I define lot of properties to ajax:AsyncFileUpload now I will explain all the
Now in code behind add following namespaces
C# Code
using System; using System.Web.UI; using AjaxControlToolkit; |
After completion of adding namespaces write following code in code behind
protected void fileUploadComplete(object sender, AsyncFileUploadEventArgs e) { string filename = System.IO.Path.GetFileName(fileUpload1.FileName); fileUpload1.SaveAs(Server.MapPath("Files/") + filename); } |
VB Code
Imports System.Web.UI
Imports AjaxControlToolkit
Partial Class Default
Inherits System.Web.UI.Page
Protected Sub fileUploadComplete(ByVal sender As Object, ByVal e As AsyncFileUploadEventArgs)
Dim filename As String = System.IO.Path.GetFileName(fileUpload1.FileName)
fileUpload1.SaveAs(Server.MapPath("Files/") & filename)
End Sub
End ClassHow Install Ajax in visual studio?
1) First step is to download the latest version of the Ajax Control Toolkit from CodePlex whichever suits to your visual studio. If you are using Visual Studio 2008 then you should pick the version of the Ajax Control Toolkit for .NET 3.5. If you are using Visual Studio 2010 then you can use either the .NET 4 or .NET 3.5 versions of the Ajax Control Toolkit.
ou made such an interesting piece to read, giving every subject enlightenment for us to gain knowledge. Thanks for sharing the such information with us
ReplyDeleteData Science course in rajaji nagar
Data Science with Python course in chenni
Data Science course in electronic city
Data Science course in USA
Data science course in pune | Data Science Training institute in Pune
Data science course in bangalore
Outstanding blog thanks for sharing such wonderful blog with us ,after long time came across such knowlegeble blog. keep sharing such informative blog with us.
ReplyDeleteredmi note service center in chennai
redmi service center in velachery
redmi service center in t nagar
redmi service center in vadapalani
ReplyDeleteThanks For Sharing Content
Big Data Analytics Training In Hyderabad
Big Data Analytics Course In Hyderabad
Thanks for sharing content and such nice information for me. I hope you will share some more content about. Please keep sharing!
ReplyDeleteArtificial Intelligence Training In Hyderabad
Great writing! You have a flair for informational writing. Your content has impressed me beyond words.Thank you for all your valuable input on this topic.
ReplyDeleteSAP training in Kolkata
Best SAP training in Kolkata
SAP training institute in Kolkata
The Content You Shared With Us Is Excellent & Extraordinary Useful to all Aspirants Thanks For Sharing With Us!
ReplyDeleteBest Degree College In Hyderabad
Top Degree College In Hyderabad
Top And Best BBA College In Hyderabad
Top And Best B.Com College In Hyderabad
Outstanding blog thanks for sharing such wonderful blog with us ,after long time came across such knowlegeble blog.
ReplyDeletejava training in chennai
java training in omr
aws training in chennai
aws training in omr
python training in chennai
python training in omr
selenium training in chennai
selenium training in omr
Thanks a lot very much for the high your blog post quality and results-oriented help. I won’t think twice to endorse to anybody who wants and needs support about this area.
ReplyDeletejava training in chennai
java training in velachery
aws training in chennai
aws training in velachery
python training in chennai
python training in velachery
selenium training in chennai
selenium training in velachery
Thank you so much for this incredible guide. This has given me so much information
ReplyDeletedata science training in chennai
data science training in annanagar
android training in chennai
android training in annanagar
devops training in chennai
devops training in annanagar
artificial intelligence training in chennai
artificial intelligence training in annanagar
A great piece of writing! You have an efficient flair for high quality writing. I am highly impressed by your way of writing this content beyond words. I really have a lot of appreciation for your writing. Thank you so much for all your priceless input on this topic.
ReplyDeleteSAP training in Kolkata
SAP course in kolkata
SAP training institute in Kolkata
Thanks for posting the best information and the blog is very important
ReplyDeletedata science interview questions and answers
Very nice blog. A great piece of writing. You have shared a true worthy blog and keep sharing more blogs with us. Thank you.
ReplyDeleteData Science Certification in Hyderabad