Checking Java File Download Size


I am using jsp/servlet for file upload,

i am able to upload a file but want to limit the size of files that can be uploaded. Is there any way to check the size of file without uploading it.. (on server side)

You can set setSizeThreshold using commons-fileupload

Note: *You can't determine the file size without streaming it up directly to server*