7 Replies Latest reply on Mar 10, 2011 1:58 PM by John Stegeman

    File Upload Size-Exceed Error Message


      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?

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

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

          • 2. Re: File Upload Size-Exceed Error Message

            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!
            • 3. Re: File Upload Size-Exceed Error Message
              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?
              • 4. Re: File Upload Size-Exceed Error Message
                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:

                <!-- Maximum memory per request (in bytes) -->
                <!-- Use 500K -->
                <!-- Maximum disk space per request (in bytes) - Uploadfiles larger than this will force an Exception -->
                <!-- Use 500M -->

                I hope that helps!

                • 5. Re: File Upload Size-Exceed Error Message
                  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
                    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.