Upfile.aspx.cs
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 Inc_Upfile : System.Web.UI.Page
...{
protected void Page_Load(object sender, EventArgs e)
...{
//Cut By 梦溪苑。
}
protected void Button1_Click(object sender, EventArgs e)
...{
AllSheng.upload UpFiles = new AllSheng.upload();
//HttpPostedFile File = FileUpload1.PostedFile;
// AllSheng.UploadObj.PhotoSave("/", FileUpload1);
HttpFileCollection files = HttpContext.Current.Request.Files;
UpFiles.Path = "../UpLoadfiles";
String ReStr= UpFiles.SaveAs(files).ToString();
Label1.Text = ReStr;
UpFiles = null;
}
}
}
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Upfile.aspx.cs" Inherits="Inc_Upfile" %>
- <!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>
- <link href="../Manage/Style.Css" type="text/css" rel=Stylesheet />
- </head>
- <body>
- <form id="form1" runat="server">
- <div style="left: 0px; clip: rect(0px auto auto 0px); position: absolute; top: 0px">
- <asp:FileUpload ID="FileUpload1" runat="server" />
- <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="上传文件" CssClass="btn2" />
- <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></div>
- </form>
- </body>
- </html>
Upfile.aspx.cs
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 Inc_Upfile : System.Web.UI.Page
...{
protected void Page_Load(object sender, EventArgs e)
...{
//Cut By 梦溪苑。
}
protected void Button1_Click(object sender, EventArgs e)
...{
AllSheng.upload UpFiles = new AllSheng.upload();
//HttpPostedFile File = FileUpload1.PostedFile;
// AllSheng.UploadObj.PhotoSave("/", FileUpload1);
HttpFileCollection files = HttpContext.Current.Request.Files;
UpFiles.Path = "../UpLoadfiles";
String ReStr= UpFiles.SaveAs(files).ToString();
Label1.Text = ReStr;
UpFiles = null;
}
}
}