fix savefile response

This commit is contained in:
2020-03-04 12:07:49 +08:00
parent c117d9ef1f
commit fb1ce7d931
+3 -3
View File
@@ -33,7 +33,7 @@ namespace YYApi.Helpers
Env = env; Env = env;
} }
public class FileResult public class YYUploadInfo
{ {
public string Path { get; set; } public string Path { get; set; }
public int Size { get; set; } public int Size { get; set; }
@@ -47,7 +47,7 @@ namespace YYApi.Helpers
/// <param name="path">存放路径</param> /// <param name="path">存放路径</param>
/// <param name="fileName">文件名</param> /// <param name="fileName">文件名</param>
/// <returns></returns> /// <returns></returns>
public FileResult SaveFile(string base64, string ext = null, string path = null, string fileName = null) public YYUploadInfo SaveFile(string base64, string ext = null, string path = null, string fileName = null)
{ {
byte[] bt; byte[] bt;
var filePath = FilePath + path; var filePath = FilePath + path;
@@ -82,7 +82,7 @@ namespace YYApi.Helpers
} }
var fn = fileName + (string.IsNullOrEmpty(ext) ? string.Empty : $".{ext}"); var fn = fileName + (string.IsNullOrEmpty(ext) ? string.Empty : $".{ext}");
File.WriteAllBytes(realPath + fn, bt); File.WriteAllBytes(realPath + fn, bt);
return new FileResult return new YYUploadInfo
{ {
Path = filePath + fn, Path = filePath + fn,
Size = bt.Length Size = bt.Length