上传文件过大时,不会进入控制层,会直接抛出异常,提示上传文件过大,如下:

org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (230405130) exceeds the configured maximum (104857600)

spring-mvc.xml文件中的配置信息限制了上传文件的大小,如下:

    <bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver"
        p:defaultEncoding="UTF-8">
        <property name="maxUploadSize">
            <value>104857600</value>
        </property>
        <property name="maxInMemorySize">
            <value>4096</value>
        </property>
    </bean>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
猜你喜欢
  • 2022-02-10
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案