在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
前端: var files = []; files.push({ FileName: "1.jgp", Extension: ".jgp", FileType: 2 }); files.push({ FileName: "2.png", Extension: ".png", FileType: 2 }); files.push({ FileName: "3.bpm", Extension: ".bpm", FileType: 2 }); $.ajax({ url: "/api/file/uploadservice", type: "post", dataType: "json", data: { "": files }, success: function (res) { alert(res); }, error: function (xhr ,err) { alert(err); } }); 后台: /// <summary> /// 批量上传文件 /// </summary> /// <param name="files"></param> /// <returns></returns> [HttpPost] [Route("uploadservice")] public HttpResponseMessage AppendFiles(List<FileInfo> files) { //上传文件处理 }
结果,后台中接收到的files为空
原因:jQuery的怪癖
解决:
.ajax({ url: "/api/file/uploadservice", type: "post", dataType: "json", data: { "": files }, success: function (res) { alert(res); }, error: function (xhr ,err) { alert(err); } });
参考文献:
|
请发表评论