This commit is contained in:
2025-05-14 11:21:51 +08:00
parent 8b845a27c2
commit 97acaf9195
4 changed files with 167 additions and 51 deletions
+7 -6
View File
@@ -303,15 +303,16 @@ public partial class supplierDownload : System.Web.UI.Page
{
string path = copyPath + "\\" + date + "\\" + supplier + "\\" + "车间下载";
if (!Directory.Exists(path)) Directory.CreateDirectory(path);
string fname = Path.GetFileName(file);
foreach (var rule in replaceRules)
{
rname = rname.Replace(rule.Key, rule.Value);
fname = fname.Replace(rule.Key, rule.Value);
}
File.Copy(file, path + "\\" + rname, true);
if (!File.Exists(path + "\\" + rname))
File.Copy(file, path + "\\" + fname, true);
if (!File.Exists(path + "\\" + fname))
{
File.Copy(file, path + "\\" + rname, true);
File.Copy(file, path + "\\" + fname, true);
}
}
@@ -350,7 +351,7 @@ public partial class supplierDownload : System.Web.UI.Page
{
try
{
file.Add(files[i], rnameList[i]);
file.Add(files[i]);
addFiles.Add(files[i]);
addCtid.Add(ctidLst[i]);
}
@@ -413,7 +414,7 @@ public partial class supplierDownload : System.Web.UI.Page
//通知浏览器下载文件而不是打开\\fileDownload=true; path=/
Response.AddHeader("Set-Cookie", "fileDownload=true; path=/;");
//Response.AddHeader("Cache-Control", "no-cache, no-store, must-revalidate");
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fname, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(dfile, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", bytes.Length.ToString());
Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
Response.BinaryWrite(bytes);