Troubleshooting FilePath issues
Learn how to configure FilePath control with its parameters, the symptoms and root causes of issues related to the FilePath control in your Pega applications, and how to prevent and resolve them. The scenarios describe issues with the FilePath control that users have reported.
To configure the FilePath control, follow these steps:
- Edit the FilePath section.
- Open Cell Properties.
- Click Parameters.
Parameters in Cell Properties
This parameter specifies an element to be updated onChange of the selected file.
Here, the hidden text field of same name must display on the holding section to ensure that the value is posted with the submission of the form. Ensure the pySetValueFromFileName(String) parameter receives the property name in double quotes.
Use the pxRequestor.pyFileUpload parameter to obtain file path.
Check this field to immediately update file encoding on file selection.
Ensure this property is checked for cases like the FilePath control in modal, Overlay or AJAX container.
If you have implemented custom controls, use the Set Encoding and Reset Encoding APIs for file encoding in the FilePath control to work inside the AJAX container.
Invoke the following API onChange of the file input control. This ensures that the file input control is familiar with the context and the encoding is set on the correct context.
FilePath control with non-AJAX container and direct form submit is as follows:
var oForm = document.forms;
oForm.encoding = "multipart/form-data";
FilePath control with support for AJAX container is as follows:
FilePath control causes an error on the portal work area. However, it works correctly on the out-of-the-box Profile page.
Error : pxFileNotFound on D_pzOperatorInfo page under pzFileUploadgadget.
Workarea (inner harness) is disabled for harness. Hence, the modal dialog loads as sibling instead of child to the harness in the Document Object Model (DOM).
Solution (or Suggested Approach)
Enable Workarea (inner harness) on the Advanced tab of harness in which the FilePath control is configured.
See SA-98705, FilePath control behavior incorrect.
Users upload images and attachments for display in the user interface. On click of a button, a PDF report generates on a new window defined in the activity logic and the section refresh is rendered. A button must display on the UI based on the visibility flag condition, on performing a refresh. However, the Refresh section action fails, the activity defined in the action set does not get invoked, and the button does not display on performing Refresh.
The root cause of the issue is the timing. The openUrlInWindow action does not pause the Event queue. The Refresh section action executes before the openUrlInWindow activity because the Refresh section action requires less time than the Refresh harness action. You can see this in the Tracer.
Use a separate activity to set the flag and invoke it with the Run activity action, and then the Open URL in window action with an earlier PDF generation activity. The final action can be Refresh section.
Perform a Catch Block for Filename property in the FilePath control.
See SA-80402, Refresh section does not work with FilePath control.
As an application developer, you discover that you cannot set the pxRequestor.pyFileUpload property using the FilePath control. This occurs on opening the control in a flow instead of a modal dialog.
You need to submit a form for the FilePath control to set the path on the Clipboard.
Use the pyFilePathWithForm property to set the path on the Clipboard.
The most recently updated FilePath control is available on the server. Multiple FilePath controls cannot exist on a page. The last control value updated overrides the value set on the pxRequestor.pyFileUpload parameter that is on the clipboard.
Set the Encoding Type for Direct form element and FormData object as follows for both AC and non-AC cases:
multipart/form-data, when a file path control is present in it
Verify the path of the file that is uploaded under the pyFileUpload property on the pxRequestor page on the clipboard.
The pxRequestor.pyFileUpload parameter must hold the current file selected.
The pySetValueFromFileName parameter internally adds an onChange event listener to the FilePath control. The parameter also updates the hidden control property of the same name with a new value. Check Callback if the property is not set with the filename.
Enable the SetEncodingNow option on the FilePath control parameters in the AJAX or non-AJAX containers if the file is not submitted.