Change size of MultipartFile

Hello.
I’m try to send a file with size greater than limit of MultipartFile size and get the error message:
{
“message”: “Maximum upload size of 20971520 bytes exceeded; nested exception is org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (49113863) exceeds the configured maximum (20971520)”,
“error”: “MaxUploadSizeExceededException”,
“timestamp”: “2024-07-03T09:35:40.381790”,
“status”: “Internal Server Error”
}

I’m found are solutions with spring, cuba and tomcat properties:
cuba.maxUploadSizeMb
spring.servlet.multipart.max-file-size
spring.servlet.multipart.max-request-size
server.tomcat.max-swallow-size
It’s not working… But maybe im use this properties not right.
Please help.

Hi,
If you uploading a file via REST, I think you should set property:

cuba.rest.maxUploadSize

Maximum file size (in bytes) that can be uploaded with the REST API.
Default value: 20971520 (20 Mb)

It’s mentioned in REST add-on docs: CUBA REST API

1 Like

Honestly, I tried setting up Cuba before, it didn’t work. Another try was successful, thanks!