平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UploadController.cs 725 B

4 months ago
123456789101112131415161718192021222324252627282930313233343536
  1. 
  2. //
  3. namespace SafeCampus.Web.Core;
  4. [ApiDescriptionSettings(Tag = "文件上传控制器")]
  5. public class UploadController : BaseController
  6. {
  7. private readonly IFileService _fileService;
  8. public UploadController(IFileService fileService)
  9. {
  10. _fileService = fileService;
  11. }
  12. /// <summary>1
  13. /// 上传图片
  14. /// </summary>
  15. /// <param name="file"></param>
  16. /// <returns></returns>
  17. [HttpPost("uploadImg")]
  18. [DisplayName("上传图片")]
  19. [DisableRequestSizeLimit]
  20. public async Task<long> UploadImg([FromForm] IFormFile file)
  21. {
  22. //先上传到本地,后面优化
  23. return await _fileService.UploadFile(SysDictConst.FILE_ENGINE_LOCAL, file);
  24. }
  25. }