Table of Contents

Article

Troubleshooting: Cannot close error message window for oversized file attachment

The prconfig.xml file specifies a default maximum file upload size of 10 MB:

<env name="Initialization/MaximumFileUploadSizeMB" value="10" />

This default value is also specified in the Dynamic System Setting, prconfig/initialization/maximumfileuploadsizemb/default.

At run time, instead of using the drag and drop feature, you browse your file manager and upload a file that exceeds the specified limit. An error message is displayed, but you cannot close the modal error message window because it does not contain a UI control to close it:

Modal error message window that cannot close

Using Fiddler Web Debugger to monitor this interaction triggers an HTTP 413 status code error.

Error

User attempted to upload a file larger than 10 MB. Please contact the System Administrator.

Suggested approach

To add functionality for the user to close the modal error message window for oversized file attachments, follow these steps:

  1. Save the HTML FRAGMENT UserWorkForm rule into an open ruleset version and add the following JavaScript:

<script>

function overcome_size_limit()

{

pega.u.d.hideModalWindow();

}

</script>

  1. Create an HTML file to display an informative error message, for example, myError.html.
  2. Add the following code to the HTML file:

<html>

<body>

<h4>Error</h4>

<p>File being uploaded is larger than the limit of 10 MB. Reduce the file size or contact your system administrator.</p>

</body>

</html>

In subsequent steps, you place this HTML file in the WEB-INF folder of the directory where PRPC is installed on the application server.

  1. Is your application server Tomcat?

Go to Step 6.

  1. Is your application server WebLogic, WebSphere Application Server, or JBoss?

Go to Step 7.

  1. If you are using Tomcat, follow these steps:
    1. Place the HTML file that you created in Steps 2 and 3 in the WEB-INF folder of prweb directory.
    2. Find the web.xml file in the WEB-INF folder.
    3. Add the following code to the web.xml file.

      <error-page>

       <error-code>413</error-code>

           <location>/WEB-INF/myError.html</location>

      </error-page>

    4. Go to Step 8.
  2. If you are using WebLogic, WebSphere Application Server, or JBoss, follow these steps:
    1. Find the \prpc_j2ee14.ear\prweb.war\WEB-INF directory.
    2. Back up your existing prweb.war or prpc_j2ee14.ear file.
    3. Undeploy the prweb.war or prpc_j2ee14.ear file.
    4. Using a file compression utility like 7-Zip, drag and drop the myError.html file into the \prpc_j2ee14.ear\prweb.war\WEB-INF directory.
      WEB-INF folder where myError.html is stored
    5. Find the web.xml file in the \prpc_j2ee14.ear\prweb.war\WEB-INF directory.
    6. Add the following code to the web.xml file.

      <error-page>

         <error-code>413</error-code>

         <location>/WEB-INF/myError.html</location>

      </error-page>

    7. Update the prweb.war or prpc_j2ee14.ear file.
    8. If you have issues packaging the prweb.war or prpc_j2ee14.ear file, contact Global Customer Support.
    9. Redeploy the updated prweb.war or prpc_j2ee14.ear file by using the WebLogic, WebSphere Application Server, or JBoss console.
  3. Restart the application server.
  4. Retest your scenario to verify that your customized error message window behaves as expected:
    1. Browse for a file to attach to a work form in your application.
    2. Attach a file whose size is more than the size that is specified in the prconfig.xml file, the value specified for Initialization/MaximumFileUploadSizeMB or the Dynamic System Setting, prconfig/initialization/maximumfileuploadsizemb/default.
    3. In the modal window that displays the customized message from the myError.html file, click the link to close the modal error message window.

Custom modal error window that can close​​

Published June 11, 2014 — Updated April 6, 2018

Related Content

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.