diff --git a/Helpers/YYUpload.cs b/Helpers/YYUpload.cs index e8eeb34..6f582aa 100644 --- a/Helpers/YYUpload.cs +++ b/Helpers/YYUpload.cs @@ -33,6 +33,12 @@ namespace YYApi.Helpers Env = env; } + public class FileResult + { + public string Path { get; set; } + public int Size { get; set; } + } + /// /// 保存base64文件,如果有标头按照标头自动识别 /// @@ -41,7 +47,7 @@ namespace YYApi.Helpers /// 存放路径 /// 文件名 /// - public string SaveFile(string base64, string ext = null, string path = null, string fileName = null) + public FileResult SaveFile(string base64, string ext = null, string path = null, string fileName = null) { byte[] bt; var filePath = FilePath + path; @@ -76,7 +82,11 @@ namespace YYApi.Helpers } var fn = fileName + (string.IsNullOrEmpty(ext) ? string.Empty : $".{ext}"); File.WriteAllBytes(realPath + fn, bt); - return filePath + fn; + return new FileResult + { + Path = filePath + fn, + Size = bt.Length + }; } } }