diff --git a/src/YhCore.Service/Impl/FileService.cs b/src/YhCore.Service/Impl/FileService.cs
index 79d2cd6..70fd16d 100644
--- a/src/YhCore.Service/Impl/FileService.cs
+++ b/src/YhCore.Service/Impl/FileService.cs
@@ -214,9 +214,15 @@ namespace YhCore.Service.Impl
if (string.IsNullOrEmpty(fileUrl))
return "";
- // 相对路径如 /upload/docprint/20260101/{guid}.jpg → Config.FilePath + 子路径
+ // 新数据:fileurl 以 FILE_PATH 开头(如 /data/upload/docprint/20260101/{guid}.jpg)→ 剥前缀映射回 FILE_PATH。
+ // 注意必须用未 TrimStart 的原始 fileUrl 比较(FILE_PATH 本身以 / 开头)
+ string fp = Config.FilePath;
+ if (!string.IsNullOrEmpty(fp) && fileUrl.StartsWith(fp, StringComparison.OrdinalIgnoreCase))
+ return Path.Combine(fp, fileUrl.Substring(fp.Length).TrimStart('/').Replace('/', Path.DirectorySeparatorChar));
+
+ // 旧数据:相对路径如 /upload/docprint/20260101/{guid}.jpg(不含 FILE_PATH 前缀)→ StorageRoot + 子路径
var relative = fileUrl.TrimStart('/');
- string prefix = Config.FilePath;
+ const string prefix = "upload/";
if (relative.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
relative = relative.Substring(prefix.Length);
@@ -229,7 +235,8 @@ namespace YhCore.Service.Impl
if (!string.IsNullOrEmpty(Config.FilePath))
return Config.FilePath;
- return Path.Combine(AppContext.BaseDirectory,Config.FilePath);
+ // 此分支仅在 FILE_PATH 未配置时执行(此时 Config.FilePath 为 null,不可再参与拼接)
+ return Path.Combine(AppContext.BaseDirectory, "upload");
}
}
}
diff --git a/src/YhCore.WebApi/Controllers/Api/Common/CommonController.cs b/src/YhCore.WebApi/Controllers/Api/Common/CommonController.cs
index ae7ddfb..99641fc 100644
--- a/src/YhCore.WebApi/Controllers/Api/Common/CommonController.cs
+++ b/src/YhCore.WebApi/Controllers/Api/Common/CommonController.cs
@@ -235,42 +235,58 @@ namespace YhCore.WebApi.Controllers.Api.Common
///
/// 公用附件上传(旧 FileUpload,[NoAuth])。
- /// chunk 参数 → 分片保存返回 {code:1,type:"chunk",msg};fileName 参数 → 合并分片;否则单文件上传。
+ /// 分片(chunk/chunkIndex + totalChunks>1)→ 分片保存返回 {code:1,type:"chunk",msg};
+ /// 只带 fileName 不带文件 → 合并分片;带文件 → 单文件直传
+ /// (前端单文件直传也会带 guid/chunkIndex=0/totalChunks=0/fileName,不得误入合并分支)。
+ /// guid/chunk/fileName 兼容 query 与 form 两种形态(旧版读 Query)。
/// 落库 Common_UpFiles(TopicType=AppCode),返回 {fileurl,host,fileid,name,type}。
///
[HttpPost("FileUpload")]
public async Task