Hi,
I used the following to check the size. It is not exact but it's better than nothing...

if ( (sz = request.getContentLength()) > (maxFileSz)  ) {
resp.getWriter().write("<span style='color:red;'>Maximum transfer size of: " + maxFileSz + " bytes exceeded!</span>");
   return;
}

Spencer


Spencer Elliott wrote:
Hi,
I am using the common.fileupload 1.2 streaming API to upload files using AJAX (YAHOO) and servlets.

I have used setFileSizeMax to limit file upload size but find it unacceptable because the exception is not triggered until setFileSizeMax bytes are read/written.

I would like to check the file sizes before the upload begins. Is there a way to access fileSize property?

I have also attempted to use the progressListener and this gives me the file size sooner but I am unsure what the proper procedure is to terminate the stream from the listener?

Thanks,

Spencer

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


__________ NOD32 2093 (20070303) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to