[FileUpload ] Multiple files and getting file sizes early ?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[FileUpload ] Multiple files and getting file sizes early ?

Henrik Lynggaard Hansen
Hi

I have a situation where users select multiple files to upload. We have a
maximum size limit on the individual files.

The problem is that I would like to give the users an early warning if they
have selected a file that is too big.

Lets say that that the user has selected 5 files oof 3 mb each and one file
of 4 mb, and lets asume the filelimit is 3.5 mb per file.

So far only been able to get the sizes after the entire upload of the 19 mb
is completed. :-(

Looking at the RFC for multipart upload it does appear that the headers are
sent before the actual filecontent, so that makes me think I can get the
file sizes before the actual content is ready.

Looking at FileUploadBase.parse() it very clearly waits until the entire
content is loaded, so how do I work around it ?

Side question: When will the servlet methods like doPost etc be called ?
only after the entire request is uploaded or earlier ?

Best Regards
Henrik Lynggaard