.netcore文件上传Api接口,和正常的webForm提交类似,只是用postman测试接口时,记得给form表单命名,否则获取上传文件数量一直为0
后端代码
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using MyApiCommon; namespace MyApi.Controllers { [Route("api/[controller]")] [ApiController] public class FileController : ControllerBase { [HttpPost] [Route("postfile")] publ