7 Replies Latest reply: Mar 10, 2011 7:58 AM by John Stegeman RSS

    File Upload Size-Exceed Error Message

    600450
      Hi,

      I'm using the ADF inputFile component to upload files into a database. If a file's size exceeds the maximum size, the Exception

      java.io.EOFException: Per-request disk space limits exceeded

      is thrown.

      Instead of this Exception, I want a pop-up or error message to be shown, but I don't know how to set it in the backing bean of the page, because the Exception is always thrown before any of the backing bean's code is executed!

      Does anybody know how to do so?

      Sebastian
        • 1. Re: File Upload Size-Exceed Error Message
          Frank Nimphius-Oracle
          Hi,

          I think the key is to check the file content length in the managed bean before processing the upload in ADF Faces

          Frank
          • 2. Re: File Upload Size-Exceed Error Message
            600450
            Hi,

            I made the workaround by setting up the oracle.adf.view.faces.UPLOAD_MAX_DISK_SPACE variable higher than an own variable reflecting the maximum upload size and used my own variable to test the size.

            Not nice, but it works!

            Thank you for your help!
            Sebastian
            • 3. Re: File Upload Size-Exceed Error Message
              594734
              Hi Sebastian, I have a problem similar to that you describe.
              I need to validate the file size being uploaded before it is transferred.
              The first code is executed when I submit the file is the following:
              public void onUploading(ValueChangeEvent evt){

              uploadedFile = (UploadedFile)evt.getNewValue();
              if(uploadedFile != null){
              fileName = uploadedFile.getFilename();
              }
              }
              However, when I upload a big file (e.g. 200Mb)
              the system delay a lot before execute the above code. So, I think the file is transfered before execute the code and on this way I have no chance to validate the size first.
              Could you show me how you solve this problem?
              Regards.
              • 4. Re: File Upload Size-Exceed Error Message
                600450
                Hola Beto,

                yeah, before the "onUploading" function is called, internally some kind of file size validation is done without chance to circumvent (without writing an own class). The validation is performed against the variable "oracle.adf.view.faces.UPLOAD_MAX_DISK_SPACE" (found in the web.xml)

                My workaround is, that I choosed the number of this variable higher than an own variable, such that the "internal" validation succeeds and the "onUploading" method is entered. There I use my own variable to test for a maximum file size and take out a message if the file size is too large (instead of an exception :-) )!

                With larger files, I further needed to increase the variable "oracle.adf.view.faces.UPLOAD_MAX_MEMORY" which seems to represent some kind of "buffer variable".

                For files with size smaller than 500MB, I use the combination:

                <context-param>
                <!-- Maximum memory per request (in bytes) -->
                <param-name>oracle.adf.view.faces.UPLOAD_MAX_MEMORY</param-name>
                <!-- Use 500K -->
                <param-value>512000</param-value>
                </context-param>
                <context-param>
                <!-- Maximum disk space per request (in bytes) - Uploadfiles larger than this will force an Exception -->
                <param-name>oracle.adf.view.faces.UPLOAD_MAX_DISK_SPACE</param-name>
                <!-- Use 500M -->
                <param-value>512000000</param-value>
                </context-param>

                I hope that helps!

                Sebastian
                • 5. Re: File Upload Size-Exceed Error Message
                  541260
                  Has anybody figured out how to catch this exception if it's thrown before your managed bean gets called?
                  • 6. Re: File Upload Size-Exceed Error Message
                    708783
                    Hi,
                    Getting same error when uploading more than 2 MB file. I can have work around as mentioned above but then in this i can not be sure of the file that user can upload.
                    Using ADF 10.1.2.x
                    How can i enter in to method defined in bkb before it throws exception.

                    can anyone help.
                    • 7. Re: File Upload Size-Exceed Error Message
                      John Stegeman
                      Your question is not clear. I guess by "bkb" you mean backing bean? Typing a few more characters would have made this so much clearer.

                      The file must be uploaded before the size can be checked, so there's not much you can do.