😎增加文件上传时格式和大小显示
This commit is contained in:
parent
acf1ea7d1b
commit
ae7f54c4d6
@ -315,11 +315,11 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
|
|
||||||
// 验证文件类型
|
// 验证文件类型
|
||||||
if (!_uploadOptions.ContentType.Contains(file.ContentType))
|
if (!_uploadOptions.ContentType.Contains(file.ContentType))
|
||||||
throw Oops.Oh(ErrorCodeEnum.D8001);
|
throw Oops.Oh($"{ErrorCodeEnum.D8001}:{file.ContentType}");
|
||||||
|
|
||||||
// 验证文件大小
|
// 验证文件大小
|
||||||
if (sizeKb > _uploadOptions.MaxSize)
|
if (sizeKb > _uploadOptions.MaxSize)
|
||||||
throw Oops.Oh(ErrorCodeEnum.D8002);
|
throw Oops.Oh($"{ErrorCodeEnum.D8002},允许最大:{_uploadOptions.MaxSize}KB");
|
||||||
|
|
||||||
// 获取文件后缀
|
// 获取文件后缀
|
||||||
var suffix = Path.GetExtension(file.FileName).ToLower(); // 后缀
|
var suffix = Path.GetExtension(file.FileName).ToLower(); // 后缀
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user