diff --git a/Tiobon.Core.Api/Controllers/FileController.cs b/Tiobon.Core.Api/Controllers/FileController.cs index 764bfdb7..495e14cb 100644 --- a/Tiobon.Core.Api/Controllers/FileController.cs +++ b/Tiobon.Core.Api/Controllers/FileController.cs @@ -109,9 +109,9 @@ public class FileController : BaseApiController string pathHeader = "wwwroot/files/" + filePath; if (!Directory.Exists(pathHeader)) Directory.CreateDirectory(pathHeader); - long fileName = SnowFlakeSingle.instance.getID(); + var fileName = upload.fileName.Replace("." + ext, "_") + DateTime.Now.ToString("yyyyMMddHHmmss"); - filePath = "/files/" + filePath + "/" + $"{upload.fileName}_{fileName}.{ext}"; + filePath = "/files/" + filePath + "/" + $"{fileName}.{ext}"; //var filepath = Path.Combine(pathHeader, file.FileName); using (var stream = global::System.IO.File.Create("wwwroot/" + filePath)) { @@ -123,7 +123,7 @@ public class FileController : BaseApiController fileAttachment.AttachFileName = upload.file.FileName; fileAttachment.CreateBy = App.User.ID; fileAttachment.CreateTime = DateTime.Now; - fileAttachment.AttachmentName = fileName.ToString(); + fileAttachment.AttachmentName = fileName; fileAttachment.AttachFileExtension = ext; fileAttachment.AttachFileSize = upload.file.Length; fileAttachment.PhysicsPath = filePath; @@ -139,7 +139,7 @@ public class FileController : BaseApiController Id = fileAttachment.Id, AttachFileExtension = fileAttachment.AttachFileExtension, AttachFileName = fileAttachment.AttachFileName, - AttachmentName = fileAttachment.AttachmentName, + AttachmentName = fileName, AttachmentNo = fileAttachment.AttachmentNo, FileURL = fileAttachment.FileURL, PhysicsPath = fileAttachment.PhysicsPath,