CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/HSSE/Environmental/EnvironmentalMonitoringApiV...

41 lines
1.6 KiB
C#
Raw Normal View History

2024-12-24 19:04:32 +08:00
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HSSE.Environmental
{
public partial class EnvironmentalMonitoringApiView : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
txtUrl.Text = Funs.SGGLApiUrl;
txtProjectid.Text = this.Request.Params["Projectid"];
}
}
protected void imgbtnUpload_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/");
string filePath = "File\\Word\\HSSE\\环境监测数据接口.docx";
string uploadfilepath = rootPath + filePath;
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
System.Web.HttpContext.Current.Response.TransmitFile(uploadfilepath, 0, fileSize);
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.Close();
}
}
}