【发布时间】: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