I wrote a controller as below:
@PostMapping(value="/upload", produces = "application/json")
@ApiOperation("Upload")
@ApiIgnore
public ResponseEntity<ResponseObject> fileUpload(
@RequestParam(value="file") MultipartFile file,
@RequestParam (value="code",required=false, defaultValue="0")String code,
@RequestParam (value="approvaldetails",required=false, defaultValue="0") String approvalDeatils) throws Exception{
return uploadService.uploader(file,code,approvalDeatils);
}
and I configured below at application.porperties:
spring.servlet.multipart.max-file-size=30MB
spring.servlet.multipart.max-request-size=30MB
but I could able to upload file up to ~15MB Editted: Spring boot version: 2.0.1
1. First potential cause:
Maybe it's related to the spring-boot version you are using.
MULTIPART properties have been changed according to versions.
Spring Boot 1.3.x and earlier
After Spring Boot 1.3.x:
After Spring Boot 2.0:
2. Second potential cause:
Your app didn't have enough memory to receive the file
3. Third potential cause:
If you are packaging as war and deploying on tomcat, make sure that tomcat allows a
maxPostSizesuitable for your use case.In conf\server.xml: