example of ajax control "fileupload" using asp.net
fileupload.aspx
<%@ Page Language="C#"
AutoEventWireup="true"
CodeFile="fileupload.aspx.cs"
Inherits="fileupload"
%>
<%@ Register Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="asp"
%>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"
runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"/>
<div>
<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
onuploadcomplete="AjaxFileUpload1_UploadComplete" />
</div>
</form>
</body>
</html>
fileupload.aspx.cs
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
public partial class fileupload : System.Web.UI.Page
{
protected void Page_Load(object
sender, EventArgs e)
{
}
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
string
path = Server.MapPath("~/image") +
e.FileName;
AjaxFileUpload1.SaveAs(path);
}
}
0 comments :