File upload limits

Hi,
I’m faced with problem during file uploading. Used https://cookbook.vaadin.com/upload-image-to-file as an example. And all the time(when upload more than 1Mb file) keep getting “The field file exceeds its maximum permitted size of 1048576 bytes.”
setMaxFileSize seems does nothing.

upload = new Upload(this::receiveUpload);
upload.setMaxFiles(1);
upload.setMaxFileSize(100 * 1024 * 1024);

private OutputStream receiveUpload(…) {

File uploadedFile = File(contentPath, fileName);
return new FileOutputStream(uploadedFile);

}

And additional question. According to doc for Upload component: “However, the user should be informed upfront about any file upload restrictions. Limitations on the maximum number of files allowed, file size, and format should all be communicated clearly, to avoid exceptions as much as possible.”
Should I do this or component does it by itself ?

Using V23, flow, Spring.

Your server may also have its own maximum file size restriction. Check the server docs for more info.

And for the second part, it’s up to you to do that.

It’s local. MacOS if it’s matter.

For the server I mean the servlet container in this case

For Spring Boot, I think the default is Tomcat

You’re right. It’s spring’s restriction. This helps:
spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=100MB
Thank you!

Good to hear it worked for you!