Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-2834

CommonsMultipartRequestHandler will lose parameters when a uploading file is too big

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.2.9
    • None
    • Example Applications
    • None
    • Operating System: All
      Platform: All
    • 39316

    Description

      I am trying to implement an upload feature for our website by using struts.
      Everything works fine except when I am trying to upload a file with size bigger
      than I configured in the struts-config, all the parameters get lost after struts
      decides the file size is too big. Since I am trying to redirect the user to a
      page with some specific IDs, I will need some parameters to be replayed. So I
      followed this class's code and tried to see how it gets lost. Here is wut happens:

      in the function handleRequest(HttpServletRequest request) at line 166:
      try

      { items = upload.parseRequest(request); }

      catch (DiskFileUpload.SizeLimitExceededException e)

      { // Special handling for uploads that are too big. request.setAttribute( MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED, Boolean.TRUE); return; }

      So when the class get an SizeLimitExceededException from DiskFileUpload, it will
      not try to replay the rest of the parameters. And as a result, I lost the
      parameter I passed in for action class to redirect the response. Think it
      through, I feel it's a struts bug rather than a commons file upload bug.
      Because commons file upload should throw an exception when the file is too big
      and struts still should replay the rest of the parameters and skip the file
      parameters.

      Attachments

        Activity

          People

            Unassigned Unassigned
            wshao@perpetual.com Weili Shao
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: