日期:2014-01-23 浏览次数:20774 次
前台shangchuan.aspx代码:
<%@ Page language="c#" Codebehind="shangchuan.aspx.cs" AutoEventWireup="false" Inherits="hualong.allknow.shangchuan" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>shangchuan</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<BODY bgcolor="#ffffff">
<FORM ENCTYPE="multipart/form-data" RUNAT="server" ID="Form1">
<TABLE RUNAT="server" WIDTH="700" ALIGN="left" ID="Table1" cellpadding="0" cellspacing="0"
border="0">
<TR>
<TD>上传图片(选择你要上传的图片)</TD>
<TD>
<INPUT TYPE="file" RUNAT="server" STYLE="WIDTH:320px" ACCEPT="text/*" NAME="up_file" id="up_file">
</TD>
</TR>
<TR>
<TD>
文件说明(添加上传图片说明,如:作者、出处)
</TD>
<TD>
<asp:TextBox RUNAT="server" WIDTH="239" ID="txtDescription" MAINTAINSTATE="false" />
</TD>
</TR>
<TR>
<TD>
<asp:Label RUNAT="server" ID="txtMessage" FORECOLOR="red" MAINTAINSTATE="false" />
</TD>
<TD>
<asp:Button RUNAT="server" WIDTH="239" TEXT="Upload Image" ID="Button1" />
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
下面是后台shangchuan.aspx.cs代码:
using System;
using System.Web;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace hualong.allknow
{
/// <summary>
/// shangchuan 的摘要说明。
/// </summary>
public class shangchuan : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox txtDescription;
protected System.Web.UI.WebControls.Label txtMessage;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.HtmlControls.HtmlInputFile up_file;
protected Int32 fileLength = 0;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
&nbs