chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using WebLib;
|
||||
|
||||
namespace Education.Forms.溝通記錄
|
||||
{
|
||||
public partial class 附件檢視 : FormBase
|
||||
{
|
||||
private int id;
|
||||
private DAC_訓練溝通記錄附件 Dao訓練溝通記錄附件;
|
||||
private string 圖檔儲存路徑;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
FunctionName = "溝通紀錄附件檢視";
|
||||
id = DAC.GetInt32(Request["id"]);
|
||||
Dao訓練溝通記錄附件 = new DAC_訓練溝通記錄附件(conn);
|
||||
圖檔儲存路徑 = Server.MapPath(Education.PublicVariable.溝通記錄上傳路徑);
|
||||
|
||||
var item = Dao訓練溝通記錄附件.SelectOne(id).FirstOrDefault();
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
string fileName = String.Format("{0}{1}\\{2:000000}.{3}", 圖檔儲存路徑, item.訓練溝通記錄編號, item.編號, item.副檔名);
|
||||
string fileName1 = Server.UrlEncode(item.檔案名稱);
|
||||
Response.ClearHeaders();
|
||||
Response.Clear();
|
||||
Response.Expires = 0;
|
||||
Response.Buffer = true;
|
||||
Response.AddHeader("Accept-Language", "zh-tw");
|
||||
Response.AddHeader("content-disposition", String.Format("attachment; filename=\"{0}\"", fileName1));
|
||||
Response.ContentType = item.ContentType;
|
||||
Response.WriteFile(fileName);
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user