提交代码

This commit is contained in:
2023-12-22 15:56:17 +08:00
parent 02f8f10a17
commit c2448c36cc
4 changed files with 23 additions and 5 deletions
@@ -49,7 +49,7 @@ namespace FineUIPro.Web.AttachFile
// 文件名完整路径
string fileName = postedFile.FileName;
// 文件名保存的服务器路径
string savedFileName = GetSavedFileName(fileName).Replace('#', '-'); ;
string savedFileName = GetSavedFileName(fileName,owner).Replace('#', '-'); ;
postedFile.SaveAs(context.Server.MapPath("~/" + attachPath + "/" + savedFileName));
string shortFileName = GetFileName(fileName);
@@ -123,11 +123,13 @@ namespace FineUIPro.Web.AttachFile
return shortFileName;
}
private string GetSavedFileName(string fileName)
private string GetSavedFileName(string fileName,string owner)
{
fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
if (!owner.Contains("DocAttachUrl"))
{
fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
}
return fileName;
}