layui文件上传需要编写动态URL的时候需要重载方法
var uploadInst = upload.render({ elem: '#WebButton' /* , url: url //此处配置你自己的上传接口即可*/ , auto: true , accept: 'file' //,multiple: true // , bindAction: '#test9' , done: function (res) { layer.msg(res.msg); console.log(res) } }); let url ; btn.addEventListener('click', function () { let select = document.querySelector('#WebSelect'); url = '/Home/Contraband?id=' + select.value + ''; //重载文件上传url uploadInst.reload({ url: url }); });