上传文件报错:The current request is not a multipart request或is a MultipartResolver configured?

上传文件报错:The current request is not a multipart request或is a MultipartResolver configured?_第1张图片
1.The current request is not a multipart request 解决方法:
1:from中涉及到图片上传的就要用post提交方式。否则就会报这个错误。

2:在jsp页面的标签里面加上,用ajax提交的时候如果没有在页面设置这个也会报这个错误。

3:在from表单的属性设置里面没加上enctype="multipart/form-data"也会报错

记住:上传下载文件要下载相应jar包
在这里插入图片描述
2.Expected MultipartHttpServletRequest: is a MultipartResolver configured解决方法

出现这个原因是需要在spring-mvc.xml 加上一句话

传文件大小上限,单位为字节(10MB)
请求的编码格式,必须和jSP的pageEncoding属性一致,以便正确读取表单的内容,默认为ISO-8859-1


              
	10485760         
       
        	
	UTF-8        
    

multipartResolver 这个很重要

3:Exception in thread "main"java.lang.NoClassDefFoundError:org/apache/xmlbeans/XmlObject

下载最新poi

http://mirrors.cnnic.cn/apache/poi/release/bin/poi-bin-3.9-20121203.zip

加入包

poi-3.9\ 所有jar包

poi-3.9\ooxml-lib下的:三个jar包

如下图所示:
上传文件报错:The current request is not a multipart request或is a MultipartResolver configured?_第2张图片
4: java.lang.NoClassDefFoundError: org/apache/commons/collections4/ListValuedMap解决方法

加上这个jar包 commons-collections4-4.1.jar

你可能感兴趣的:(报错)