官网:https://github.com/danielm/uploader
Demo Online https://danielmg.org/demo/java-script/uploader/basic
看了官方手册: Options:
extraData: (object/function) Collection of parameters to add in the upload request.
虽然功能实现了,但还是有明白的地方,如果有JS高手望指教
1 $(function () { 2 var dmUploaderCfg = { 3 url: '/Talent/BatchUploadFileTemplate', 4 maxFileSize: 3000000, // 3 Megs max 5 auto: false, 6 queue: true, 7 extraData: { resumeUpdateDate: "" }, 8 //....省略 9 }; 10 $('#drag-and-drop-zone').dmUploader(dmUploaderCfg); 11 12 $('#btnApiStart').on('click', function (evt) { //上传按钮click事件 13 evt.preventDefault(); 14 dmUploaderCfg.extraData.resumeUpdateDate = $("#txtResumeUpdateDate").val(); //获取日期值 15 $('#drag-and-drop-zone').dmUploader('start'); 16 }); 17 })
一开始,第7行没有赋值,仅仅在14行进行了赋值,服务端取不到值,何解?
//服务端代码ASP.NET MVC if (!string.IsNullOrEmpty(Request.Form["resumeUpdateDate"])) { puzzleEntity.PuzzleBasic.ResumeUpdateDate = Request.Form["resumeUpdateDate"]; }