Increase HTTP Post maxPostSize in Spring Boot

后端 未结 14 2240
无人共我
无人共我 2020-11-28 06:48

I\'ve got a fairly simple Spring Boot web application, I have a single HTML page with a form with enctype=\"multipart/form-data\". I\'m getting this error:

14条回答
  •  情书的邮戳
    2020-11-28 07:40

    from documentation: https://spring.io/guides/gs/uploading-files/

    Tuning file upload limits

    When configuring file uploads, it is often useful to set limits on the size of files. Imagine trying to handle a 5GB file upload! With Spring Boot, we can tune its auto-configured MultipartConfigElement with some property settings.

    Add the following properties to your existing src/main/resources/application.properties:

    spring.http.multipart.max-file-size=128KB

    spring.http.multipart.max-request-size=128KB

    The multipart settings are constrained as follows:

    • spring.http.multipart.max-file-size is set to 128KB, meaning total file size cannot exceed 128KB.

    • spring.http.multipart.max-request-size is set to 128KB, meaning total request size for a multipart/form-data cannot exceed 128KB.

提交回复
热议问题