Getting uploaded file base64 value

I want to upload an Excel file on Pega and then retrieve its content as base64.

While doing this, since the FilePath control hides the path, I am trying to combine the path with pxProcess.pxServiceExportPath and then read it with Java code, but I am constantly getting a file not found error.

Is it because Pega assigns unique values to the file that I cannot access it?

@MertK5088Can you try using AttachFile control ? You should have access to the file using pxRequestor.pyFileUpload.

@EngincanY I tried the suggested method, but it still uploaded to a fake path and the file could not be found. I’m leaving a screenshot below.

@MertK5088I tested the FilePath on my end and it looks like a form submission is needed to have the last uploaded file location. Can you try below?

Use pxRequestor.pyFileUpload as a property source in the FilePath control.

Add a button and define on click → refresh and use a transform or activity, then you can retrieve the file path using pxRequestor.pyFileUpload during the execution of data transform / activity.

@MertK5088

I wrote the HTML code for the section myself and added a file input widget with a specified ID. Then, I created a button and added “Run Script” and used JavaScript to convert the file to Base64. Due to a synchronization issue, I also invoked the activity from within the JavaScript code to resolve the problem.

@MertK5088 - Do you have this HTML code handy?

@EngincanYI am already calling the relevant Base64 value to the service using the refresh other section, and I am retrieving the relevant part within the activity in Java. However, I am still receiving the error that I have attached as a screenshot. Both AttachFile and FilePath works same.

@MertK5088 and can you try using refresh this section rather than other ?

@EngincanYI changed “Refresh this section” to “Refresh other” as you suggested, but I’m still getting the fakepath error. I think the issue is related to the screen being opened on top of the current screen using a local action. I believe it might be related to the “Replace Current” option in the local action settings.