【问题标题】:How can I increase maximum file upload in Vaadin - Spring Boot如何增加 Vaadin 中的最大文件上传 - Spring Boot
【发布时间】:2021-03-04 23:21:56
【问题描述】:

我正在尝试在 Vaadin 14.4.2 中上传文件

        MemoryBuffer loadWeightsBuffer = new MemoryBuffer();
        Upload loadWeightsButton = new Upload(loadWeightsBuffer);
        loadWeightsButton.setMaxFiles(1);
        loadWeightsButton.setDropLabel(new Label("Load weights"));
        loadWeightsButton.setMaxFileSize(500000000);
        loadWeightsButton.addFileRejectedListener(event -> {
            writeToTerminal(event.getErrorMessage());
        });
        loadWeightsButton.addSucceededListener(event -> {
            saveFile(event.getMIMEType(), event.getFileName(), loadWeightsBuffer, WEIGHTS);
        });

但是当我上传到大文件时出现此错误。

org.apache.tomcat.util.http.fileupload.impl.SizeLimitExceededException: the request was rejected because its size (44948839) exceeds the configured maximum (10485760)

我试图在application.properties 中添加它但没有成功。如何在 Vaadin 中增加上传大小?

spring.http.multipart.max-file-size=500MB
spring.http.multipart.max-request-size=500MB

【问题讨论】:

  • 你试过spring.servlet.multipart...吗?
  • @cfrick 哇!有用!请写出答案。

标签: spring-boot tomcat vaadin vaadin14


【解决方案1】:

有多种设置,它们随着时间的推移而变化。对于 Springboot >= 2 和 servlet 容器使用,需要设置spring.servlet.multipart(注意:servlet 而不是http)。

【讨论】:

    猜你喜欢
    • 2010-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-18
    • 2020-06-19
    相关资源
    最近更新 更多