当前位置:首页 > asp.net2.0两句代码搞定文件上传

asp.net2.0两句代码搞定文件上传

点击次数:1105  更新日期:2010-12-28
\n

1、建立FileUpLoad.aspx文件和文件夹upLoad

2、FileUpLoad.aspx代码如下:


\n

\n

<%@ 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>无标题页</title>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<asp:FileUpload ID=”FileUpload1″ runat=”server” Width=”344px” />
<asp:Button ID=”Button1″ runat=”server” onClick=”Button1_Click” Text=”上传” /><br />
<asp:Label ID=”Label1″ runat=”server” ForeColor=”Red”></asp:Label><br />

</div>
</form>
</body>
</html>

\n