发布网友 发布时间:2022-04-23 21:22
共2个回答
懂视网 时间:2022-04-24 01:43
'uploadSuccess', '#' + file.id).addClass('upload-state-done'oSuccess = oSuccess =
<input type="text" /><input type="submit" onclick="subMit()" />
function subMit(){ fn1 = busUpLoadImg("postUrl",1); fn2 = busUpLoadImg("postUrl",2); if(!(fn1() && fn2())){ layer.msg("请上传图片",{time:1500}); return false; } }
热心网友 时间:2022-04-23 22:51
if(request.getHeader("content-type")!=null&&"application/x-www-form-urlencoded".equals(request.getHeader("content-type"))){ return null;//将请求转换成MultipartHttpServletRequest MultipartHttpServletRequest mRequest=(MultipartHttpServletRequest)request; Enumeration<String> ps = mRequest.getParameterNames(); while(ps.hasMoreElements()){ String hname = ps.nextElement(); System.out.println(hname); System.out.println(mRequest.getParameter(hname)); } //获值 String value= mRequest.getParameter("key"); //获取单个数据的时候,取key值 Iterator<String> fns=mRequest.getFileNames();//获取上传的文件列表 while(fns.hasNext()){ String s =fns.next(); MultipartFile mFile = mRequest.getFile(s); if(mFile.isEmpty()){ map.put("error", "message"); }else{ String basePath=Constant.BASEPICUPLOADPATH; String dPath= Constant.SDF_PARAM.format(new Date()); File dir = new File(basePath+dPath); if(!dir.exists()){ dir.mkdirs(); } String originFileName=mFile.getOriginalFilename(); String suffix=originFileName.split("\\.")[originFileName.split("\\.").length-1]; String base64Name=UUID.randomUUID().toString(); File file = new File(basePath+dPath,base64Name+"."+suffix); try { FileUtils.copyInputStreamToFile(mFile.getInputStream(),file);//存储文件 } catch (IOException e) { e.printStackTrace(); } } } //最近刚好在做这方面的,希望能解决你的问题