0

Below is my rest endpoint and code. I am trying to upload a large file by using Multipart, but when I am attaching a large file (>100MB)in postman I am getting 503 error and request is not coming to my server.

@PostMapping("load/largefile")
    public ResponseObj loadHaevyFileToS3(@RequestPart(value = "file") MultipartFile jsonDataFile) {
        return new ResponseObj(true,loadService.load(jsonDataFile));
    }

But when I am attching file of smaller size it is working fine

I have added the below properties in my application.properties.

spring.servlet.multipart.max-request-size=500MB
spring.servlet.multipart.max-file-size=500MB
server.tomcat.max-http-form-post-size=500MB

Spring version : 5.0.8.RELEASE

Also in logs I am not getting any error and seems like call is not coming to server, but with smaller file it is coming.

I don't know what I am missing here, please help me out. Thanks in advance.

NOTE: When I am using to hit to my local(localhost:8090) it is working and call is coming to my local server but after deploying the code when I am hitting the postman to my main server I am facing the above issue. Postman Screen shot

2 Answers2

0

To upload a large file or any file you have to explicitly enable multipart as true be default it is false So to that use the following command in application.properties

 spring.servlet.multipart.enabled=true
0

Is there any other configurations in your application.properties or any other dependencies in your project ?

Adding this to your properties file should have done the work

spring:
  servlet:
    multipart:
      max-file-size: 500MB
      max-request-size: 500MB

Also setting the max file limit according to your spring version as described here

https://stackoverflow.com/a/57810158/20950641