文件上傳相關報錯: The current request is not a multipart request或is a MultipartResolver configured?


 1:from中涉及到圖片上傳的就要用post提交方式。否則就會報這個錯誤。

    2:第一中:在jsp頁面的<head></head>標簽里面加上<meta http-equiv="Content-Type" content="multipart/form-data;         charset=utf-8" />,用ajax提交的時候如果沒有在頁面設置<meta http-equiv="Content-Type"                              content="multipart/form-data; charset=utf-8" />這個也會報這個錯誤。

        原因請看http://www.tuicool.com/articles/FrY7Fv:

      3:第二種:在from表單的屬性設置里面加上enctype="multipart/form-data"

      原因請看http://zkliqiang.iteye.com/blog/779285

2:Expected MultipartHttpServletRequest: is a MultipartResolver configured?

出現這個原因是需要在spring-mvc.xml 加上一句話

 <!-- 設置上傳文件最大值   1M=1*1024*1024(B)=1048576 bytes -->    
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">    
    <property name="maxUploadSize" value="1048576" />    

</bean>  

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包

如下圖所示:

4: java.lang.NoClassDefFoundError: org/apache/commons/collections4/ListValuedMap

加上這個jar包  commons-collections4-4.1.jar


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM