How to use Ajax file uploader in c#

In this article, we will discuss that how to use Ajax file uploader in c#, Many time we want to save multiple files on one time .
Source Code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ajaxfileuploader.aspx.cs"
    Inherits="ajaxfileuploader" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        <asp:AjaxFileUpload ID="Ajaxfileupload1" runat="server" MaximumNumberOfFiles="10"
            ToolTip="Please Upload All ID Proof Of Technician" OnUploadComplete="AjaxFileUploadEvent"

Code behind(c#):-
    protected void AjaxFileUploadEvent(object sender, AjaxFileUploadEventArgs e)
        string filename = System.IO.Path.GetFileName(e.FileName);

        Ajaxfileupload1.SaveAs(Server.MapPath("~/files/") + filename);


Note :-1 we can download Download ASP.Net AJAXControl Toolkit

2. We need to create to a folder with files name in Solution Explorer 
How to use Ajax file uploader in c# How to use Ajax file uploader in c# Reviewed by NEERAJ SRIVASTAVA on 1:45:00 PM Rating: 5

No comments:

Powered by Blogger.