Description:-
Now you can see I have save uploaded file in my “Uploads” Folder in my Project. So browse your Webpage and add multiple file from AjaxFileUpload and Click Upload for upload or saving file in your Folder.
AjaxFileUpload is nothing but you can Upload and Save File
in your server folder or any other else where you want to save. Here using File Upload I will show to how to upload multiple file and save in your web
folder. For that you need AjaxControl
toolkit.
Now in your Webpage
Drag AjaxScriptManage and AjaxFileUpload Controls so we can open file and
Upload it on the Server. Before that you have to register ajaxcontroltoolkit in
your webpage.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="asp"
%>
Now Design your Webpage like below.
<div> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <div align="center"> <asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" AllowedFileTypes="jpg,jpeg,png,gif" MaximumNumberOfFiles="10" OnUploadComplete="File_Upload" Width="500px" /> </div> </div>
Now you can see in AjaxFileUpload
Control AllowedFileType Property I
have given Some File Extension for which type of file this Controls can take.
Now for saving your Uploaded file in Some Location Go to
Code behind and generate AjaxFileUpload Controls OnUploadComplete event so when all File upload done then I want to
save that file in my location.
Protected void File_Upload (object sender, AjaxFileUploadEventArgs e) { String filename = e.FileName; String strDestPath = Server.MapPath ("~/Uploads/"); AjaxFileUpload1.SaveAs (@strDestPath + filename); }
Now you can see I have save uploaded file in my “Uploads” Folder in my Project. So browse your Webpage and add multiple file from AjaxFileUpload and Click Upload for upload or saving file in your Folder.
Thanks for comments.....