Required MultipartFile parameter 'file' is not present

SpringMVC+ajaxFileUpload 上传文件出现Required MultipartFile parameter 'file' is not present错误,

找了很久原因,发现是前端的

fileElementId: 'file1',中file1一定要与Controller中

 @RequestMapping(value ="fileUpload",method ={RequestMethod.POST,RequestMethod.GET})  

   public String fileUpload(@RequestParam MultipartFile file1,HttpServletRequest request,HttpServletResponse response) {...}

 file1的名字相对应。

猜你喜欢

转载自metmhc.iteye.com/blog/2206119