本实例所做功能为发送带附件邮件,可以上传多个附件,操作为选择一个附件以后自动上传,然后继续选择附件,填写完表单其他信息,点击保存发送带附件邮件。
上传的
文件数量({n}) 超过允许的最大数值{m}!",}).on("filebatchselected",function(event,files) {
$("#fileUpload").fileinput("upload");
}).on("filebatchuploadsuccess",function (event,data,previewId,index){
if(data.response.success == true)
{
fileName.push(data.response.fileName);
}else{
alert("
上传失败!");
}
$("#fileUpload").fileinput("clear");
$("#fileUpload").fileinput("reset");
}).on('fileerror',msg) {
alert(msg);
});
}
fileUpload(HttpServletRequest request,HttpServletResponse response) {
ResourceBundle bundle = PropertyResourceBundle.getBundle("application");
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
Map fileMap = multipartRequest.getFileMap();
String rootPath = bundle.getString("upLoadUrl");
String filePath = rootPath;
Map map = new HashMap<>();
map = uploadFiles(filePath,fileMap);
return map;
}