commons-fileupload icon indicating copy to clipboard operation
commons-fileupload copied to clipboard

Adding capability to take max upload size per request.

Open nucleussoftwareopen opened this issue 2 years ago • 4 comments

As of now FileUploadBase has sizeMax which is global for all uploads, in many cases it is required to calculate this limit based on request.

https://stackoverflow.com/questions/16585866/changing-file-size-limit-maxuploadsize-depending-on-the-controller

nucleussoftwareopen avatar Dec 20 '22 10:12 nucleussoftwareopen

Hi, thanks for the PR. I'd like to understand, what this is about, or in other words: What is the use case?

In my opinion, if there really is a request, that needs special handling: Why not just create another controller?

Thanks,

Jochen

jochenw avatar Dec 20 '22 11:12 jochenw

-1, there should be tests along with new features.

garydgregory avatar Dec 20 '22 12:12 garydgregory

A valid point, Gary, I'll keep that in mind. Besides: Please, rebase.

jochenw avatar Dec 20 '22 18:12 jochenw

Hi, Thanks for sharing your thoughts & reviews. In this PR we are introducing a new functionality which allows a user to get the allowed max size for current file upload. Also, the subclasses can override the newly introduced getSizeMaxForThisRequest() method to calculate the allowed size per request. This will help users to provide granularity in the allowed max size for the files uploaded via different requests against different requirements/ use-cases.

nucleussoftwareopen avatar Dec 23 '22 15:12 nucleussoftwareopen