commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 24306] - Fileupload fails for forms with a large number of inputs
Date Fri, 08 Oct 2004 10:41:01 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=24306>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=24306

Fileupload fails for forms with a large number of inputs





------- Additional Comments From wknauf@hg-online.de  2004-10-08 10:41 -------
I encountered this problem, too. 
My form contained about 15 form fields and 5 file upload fields.
My threshold was 1 MB and so I wasted about 20 MB.

Simple workaround: I subclassed DefaultFileItemFactory and added a 
property "sizeThresholdFormField". In "createItem" I created a default FileItem 
if "isFormField" was false. For form fields I created a FileItem with a 
threshold of "sizeThresholdFormField".
So the waste of memory was much lower for form fields. On the other hand: if a 
textarea contains a lot of text it could be stored in a file, which is a loss 
of performance.

Usage: 
DiskFileUpload fileUpload = new DiskFileUpload (new HDFileItemFactory(1*1024 
*1024, 1024, repository) );

This created a FileUpload with thresholds of 1 MB for files and 1 KB for form 
fields.
In the above sample I would need 5 MB + some KB instead of 20 MB.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message