Pepster
Pepster

Reputation: 2166

Setting max-file-size for multipart uploads in spring boot using Jersey-multipart

I've tried setting this with the spring properties: spring.http.multipart.file-size-threshold=0 spring.http.multipart.max-file-size=10Mb spring.http.multipart.max-request-size=10Mb

...but that doesn't seem to do anything when using jersey multipart.

How can I set this max-file-size when using jersey?

EDIT: added code

application.properties

multipart.max-file-size=30MB
multipart.max-request-size=30MB

resource.java

@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public TmpFileInfoDto store(
        @NotNull @Valid @FormDataParam("file") final File file,
        @FormDataParam("file") final FormDataBodyPart formDataBodyPart) throws IOException {
    // upload to S3, add DB record, etc
}

Upvotes: 2

Views: 2179

Answers (1)

Luiz Rossi
Luiz Rossi

Reputation: 892

@VelNaga have anwser in the comments for me, to make easy to find this answer I am reposting the comment on the answers.

Which spring-boot version are you using?spring.http.multipart.max-file-size=10Mb will work only for spring-boot 1.4.0 and above.For spring-boot version less than 1.4 use multipart.max-file-size=10Mb.If you are using jersey client then please share the code otherwise we could not help you.

Upvotes: 2

Related Questions