<%@ Page Language="C#" AutoEventWireup="true" CodeFile="fileupload.ASPx.cs" Inherits="fileupload" %>
<!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 runat="server">
<title>文件上傳 《FileUpload》 </title>
</head>
<body>
<form id="form1" runat="server">
<div>
以前在2003的時候這個控件是做在Html裡面的,要弄就得麻煩鼠標由鍵轉成服務器控件,不知道怎麼想起的,現在又做到服務器標准控件裡面了,而且在屬性和方法上也有很合人意的改動,不錯,大家可以分享下,當然也可以看下感覺還是不錯,挖哈哈!!<br /><br /><br />
<ASP:FileUpload ID="FileUpload1" runat="server" />
<ASP:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:Label ID="Label1" runat="server" Text="Label"></ASP:Label>
</div>
</form>
</body>
</Html>
到了最重要的後台代碼顯示了,看懂按鈕中的事件代碼:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class fileupload : System.Web.UI.Page
{
protected void Page_Load(object sender,