Current request is not a multipart request


1. 文件上传需要在form表单中添加<form enctype="multipart/form-data">

 

2. SpringMVC默认是关闭fileupload功能的,开启该能够并验证文件上传:

  需要在applicationcotent.xml中做如下配置:

  文件上传

<bean id="multipartResolver"
    class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <property name="maxUploadSize" value="100000"/>
    <property name="maxInMemorySize" value="10240" />
</bean>

  或需要在web.xml的servlet中做最大文件上传配置

<multipart-config>
      <max-file-size>10000000000</max-file-size>
    </multipart-config>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM