Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb1ce7d931 | ||
|
|
c117d9ef1f |
+12
-2
@@ -33,6 +33,12 @@ namespace YYApi.Helpers
|
||||
Env = env;
|
||||
}
|
||||
|
||||
public class YYUploadInfo
|
||||
{
|
||||
public string Path { get; set; }
|
||||
public int Size { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存base64文件,如果有标头按照标头自动识别
|
||||
/// </summary>
|
||||
@@ -41,7 +47,7 @@ namespace YYApi.Helpers
|
||||
/// <param name="path">存放路径</param>
|
||||
/// <param name="fileName">文件名</param>
|
||||
/// <returns></returns>
|
||||
public string 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;
|
||||
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 YYUploadInfo
|
||||
{
|
||||
Path = filePath + fn,
|
||||
Size = bt.Length
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user