ASP.NET上传文件代码
欢迎进入.NET社区论坛,与300万技术人员互动交流 >>进入
ASP.NET上传图片代码:
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 download : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Title = “文件下载页面”;
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.ContentType = “application/vnd.ms-excel”;
Response.ContentEncoding = System.Text.Encoding.GetEncoding(“gb2312”);
Response.WriteFile(Page.MapPath(“file/新生未核查名单。xls”));
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
Response.ContentType = “application/vnd.ms-powerpoit”;
Response.ContentEncoding = System.Text.Encoding.GetEncoding(“gb2312”);
Response.WriteFile(Page.MapPath(“file/毕业设计。ppt”));
}
}
【责编:peter】