Ommadawn
Ommadawn

Reputation: 2730

Servlet MultipartConfig parameters

I'm reading the official and unofficial docs for MultipartConfig, but I don't understand the use of its parameters, specially these ones:

MaxFileSize: The maximum size allowed for uploaded files, in bytes. If the size of any uploaded file is greater than this size, the web container will throw an exception (IllegalStateException). The default size is unlimited.

fileSizeThreshold: The file size in bytes after which the file will be temporarily stored on disk. The default size is 0 bytes.

maxRequestSize: The maximum size allowed for a multipart/form-data request, in bytes. The web container will throw an exception if the overall size of all uploaded files exceeds this threshold. The default size is unlimited.

I think MaxFileSize is the value for the maximum file size, isn't it? But... what about the other 2 parameters? Could anyone explain me them in other words?

Thanks!

Upvotes: 0

Views: 1067

Answers (1)

borowis
borowis

Reputation: 1235

fileSizeThreshold: The file size in bytes after which the file will be temporarily stored on disk. The default size is 0 bytes.

The uploaded file can reside in server's memory or be stored to disk in some temp location, this setting is the threshold between the two states.

maxRequestSize: The maximum size allowed for a multipart/form-data request, in bytes. The web container will throw an exception if the overall size of all uploaded files exceeds this threshold. The default size is unlimited.

One multipart request might contain a bunch of small files, that's the total limit = the sum of all the uploaded files sizes.

Upvotes: 1

Related Questions