Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: File upload problem

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default File upload problem

    Greetings,

    I have a problem with uploading of big files.
    I have simple html form on client side.
    On server side a have a servlet that processes multipart requests with commons-fileupload library. I set max request size :
    		DiskFileItemFactory factory = new DiskFileItemFactory();
    		ServletFileUpload upload = new ServletFileUpload(factory);
                    upload.setSizeMax(maxRequestSize);
    		upload.setFileSizeMax(maxRequestSize);
    So, if the file is too big
                    upload.parseRequest(request);
    throws an exception.

    The problem is:
    When uploaded file is too big servlet throws SizeLimitExceededException and finishes his work very quickly but on client side form submit continues and I have to wait several minutes until it ends. Why this is happened? And how can I cancel client form submit when servlet throws an exception?

    I use JBoss 4.2.3 and commons-fileupload-1.2.2.

    Thanks in advance


  2. #2
    Junior Member
    Join Date
    Sep 2011
    Location
    philadelphia
    Posts
    8
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: File upload problem

    it maybe a problem how your action class handle the exception.
    Acoolme is an Online Marketing Software Platform And Social Community

  3. #3
    Super Moderator Sean4u's Avatar
    Join Date
    Jul 2011
    Location
    Tavistock, UK
    Posts
    637
    Thanks
    5
    Thanked 103 Times in 93 Posts

    Default Re: File upload problem

    HTTP/1.1: Status Code Definitions

    How well a 413+close works depends on your web framework's support for close-after-response and the way your client reacts to a closed connection. It may be that the client will not read the response until the request has finished, in which case closing the connection mid-request will prevent your client seeing the 413 response. It might not be too bad if you were to use scripts to upload files, but on a form submit I think closing the connection would be catastrophic.

Similar Threads

  1. file upload size limit
    By shiv@P in forum JavaServer Pages: JSP & JSTL
    Replies: 2
    Last Post: December 24th, 2012, 11:50 PM
  2. Want to upload csv file of greter than 200 Mb
    By shreyansh in forum Java Servlet
    Replies: 6
    Last Post: February 8th, 2011, 07:43 PM
  3. Upload Image / Document
    By systech44 in forum Java Servlet
    Replies: 1
    Last Post: August 11th, 2010, 09:42 AM
  4. java.net.HttpURLConnection:large file to upload
    By tommy_725 in forum Java Networking
    Replies: 1
    Last Post: October 28th, 2009, 11:53 AM
  5. How to upload a file by clicking a link instead of button?
    By raghuprasad in forum Java Theory & Questions
    Replies: 2
    Last Post: May 3rd, 2009, 05:21 AM