文件上传错误信息:Expected MultipartHttpServletRequest: is a MultipartResolver configured?
springMVC使用multipartFile上传文件出错:Expected MultipartHttpServletRequest: is a MultipartResolver configured?
该错误信息是由于springmvc配置信息的id必须为multipartResolver
修改之前代码:
1 <!--注册文件上传解析器--> 2 <bean id="commonsMultipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> 3 <property name="defaultEncoding" value="UTF-8"></property> 4 </bean>
修改之后代码:
1 <!--注册文件上传解析器--> 2 <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> 3 <property name="defaultEncoding" value="UTF-8"></property> 4 </bean>