Hi Kishore,

When the 1MB limit is exceeded an IOException will be thrown. I catch the
IOException as well as a FileNotFoundException when using the
MultipartRequest as follows...


        try {
          // Establish a new MultipartRequest with a 1 meg upload limit
          multi = new MultipartRequest(request, thisJobPath + "\\" +
tempName, 1 * 1024 * 1024);
        }
        catch (FileNotFoundException fnfe) {
          badUpload = true;
        }
        catch (IOException ioe) {
          badUpload = true;
        }


Hope this helps.

Mike Cronin
Data On Call


-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Kishore Kamath
Sent: Tuesday, June 18, 2002 4:27 AM
To: [EMAIL PROTECTED]
Subject: OReilly MultiPart Exception


Hi,
I am using the OReilly MultiPartRequest class for implementing the upload
feature in my application. I have limited the upload size to 1MB. The
feature works fine when the files are of size < 1MB. The problem arises when
I try to upload files of sizes > 1MB. I am unable to trap the exception
arising due to this deliberate violation of size restriction.
There is no error message on the server and the message displayed to the
user is "Page cannot be displayed" on IE.

What I had in mind was, when a user tries to upload a file greater than the
specified size I will trap the exception or condition and display a suitable
error message to the user and delete the file if it got uploaded on the
server.

Has anybody else faced this problem?
Any pointers to a solution?
Thanks in advance.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to