平安校园
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.
 
 
 
 
 
 

37 lines
725 B

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