李昊 4 years ago
parent
commit
f36d7bba32

+ 2 - 1
GxPress/Api/GxPress.Api/AdminControllers/AdminFileController.cs

@@ -28,6 +28,7 @@ namespace GxPress.Api.AdminControllers
         /// <param name="file"></param>
         /// <returns></returns>
         [HttpPost("upload")]
+        [RequestSizeLimit(900_000_000)]
         public async Task<ResultPath> Upload(IFormFile file)
         {
             if (file == null) throw new BusinessException("请选择需要上传的文件");
@@ -72,7 +73,7 @@ namespace GxPress.Api.AdminControllers
             saveResult.AbsolutePath = Request.Scheme + "s://" + Request.Host.Host +
                                       (Request.Host.Port > 0 ? $":{Request.Host.Port}" : string.Empty) +
                                       saveResult.RelativePath;
-            
+
 
             return saveResult;
         }

+ 3 - 0
GxPress/Api/GxPress.Api/AppControllers/FileController.cs

@@ -45,6 +45,7 @@ namespace GxPress.Api.AppControllers
         /// <param name="file"></param>
         /// <returns></returns>
         [AllowAnonymous]
+        [RequestSizeLimit(900_000_000)]
         [HttpPost("upload")]
         public async Task<ResultPath> Upload(IFormFile file)
         {
@@ -91,6 +92,7 @@ namespace GxPress.Api.AppControllers
         /// <param name="file"></param>
         /// <returns></returns>
         [HttpPost("uploads")]
+        [RequestSizeLimit(900_000_000)]
         [AllowAnonymous]
         public async Task<List<ResultPath>> Uploads(List<IFormFile> file)
         {
@@ -171,6 +173,7 @@ namespace GxPress.Api.AppControllers
         /// <param name="code"></param>
         /// <returns></returns>
         [HttpPost("upload-files")]
+        [RequestSizeLimit(900_000_000)]
         [AllowAnonymous]
         public async Task<List<ResultPath>> UploadFiles(List<IFormFile> file, [FromForm] string code)
         {

+ 1 - 1
GxPress/Api/GxPress.Api/Startup.cs

@@ -47,7 +47,7 @@ namespace GxPress.Api
             //文件上传限制60MB
             services.Configure<FormOptions>(options =>
             {
-                options.MultipartBodyLengthLimit = 6000000000;
+                options.MultipartBodyLengthLimit =  int.MaxValue;
             });
 
             //数据库