0

I've the below uploadfile method to upload multipart files and I see 413 Request Entity Too Large while uploading a large size file like 28MB. I've set maxPostSize to 50MB in tomcat 9 server configurations and also tried which is suggested in below link. I've added below spring.servlet properties in application.properties file.

spring.servlet.multipart.max-file-size=-1
spring.servlet.multipart.max-request-size=-1
spring.servlet.multipart.enabled=true
@PostMapping(********)
@ResponseBody
public response uploadfile(
    @RequestParam(value = "id", required = true) String id,
    @RequestPart(value = "file", required = false) MultipartFile multipartFile,
    @RequestPart(required = true) data data) throws ServicesException {
    return service.uploadfile(id, multipartFile, data);
}

I've tried suggestions in below link but still seeing the same error: Spring Boot Upload Multipart 413 Request Entity Too Large

2
  • 2
    Can you also post your stacktrace? Commented Oct 28, 2020 at 20:57
  • And which multipartResolver are you using? Commented Oct 29, 2020 at 10:10

1 Answer 1

2

Do you use ngrok or any proxy? By default in Spring, you should get:

"status": 500,
"error": "Internal Server Error",
"message": "Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes.",

So I think you should check some firewall configurations, because the issue may lie there.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.