protected void btnFileDown_Click(object sender, EventArgs e)
{
SKK.BBL.NewClothList client = new SKK.BBL.NewClothList();
Button btn = sender as Button;
int CC_id = Convert.ToInt32();
DataSet ds = client.NewClothSelectByID(CC_id) as DataSet;
string FileName = ds.Tables[0].Rows[0]["Annex"].ToString();
if (string.IsNullOrEmpty(FileName))
{
(this, "此文件没在系统里,请与有关人员联系");
}
else
{
file = new (FileName);
string ct = Response.ContentType;
Response.Clear();
Response.AppendHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AppendHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
file = null;
Response.Clear();
Response.ContentType = ct;
}
}
上面是下载的代码,你自己去看看吧!!!