Question
Last activity: 19 Jan 2017 0:55 EST
Upload a File and Read/Encode
Hi Team, I have a requirement to upload a file and save that file to particular location. I am uploading a file using FilePath control in UI and i am calling pyUploadFile activity to read/encode the file . pyRequestor.pyFileUpload is getting updated with service export path. But pyUploadFile activity is not considering it as a file from service export path , getting File doesn't exist error. This Scenario is independent , not related to work object attachments. Can any one assist in resolving this and do we need to do any thing to upload to service export path? And How file gets uploaded to service export path?
Thanks in advance.
Regards,
Suresh
***Updated by moderator: Lochan to add Categories***


Pegasystems Inc.
IN
I am also using the FilePath control in UI Portal (7.1.7 version). Then pyRequestor.pyFileUpload is not getting updated by using Filepath Control. Do we need to do any thing else for this?
The UpdateFile function in Java is not considering it as file if we manually try to set the path on pyRequestor.pyFileUpload (eg:file://web:/StaticContent/global/ServiceExport/123.txt) 123.txt existing file in local system .Could you please provide elaborated explanation for this .
Hi,
Have you tried with other file type extensions. Link provided by Akshay is helpful for your scenario.
Thanks,
Prudhvi
Hi Prudhvi, I Have tried with other extensions also. I have gone through link provided by Akshay. I tried similar way. still i am facing issue.
Its working in for work object attachments scenario. but not in seperate portal UI with out object.
please help me in knowing details below.
1) Is the filepath control uploads a file to service export path? If so how , Where in filepath control it happens?(I have gone through control code. Not getting where it happens)
2)In UploadFile Function java code is in a way that it takes path from requestor page pyFileUpload. Which is service export path. How to check files present in service export path?
Thanks.
Suresh
You can create a file listener rule to read the uploaded file from service export path and encode it. You can write an intial activity in service file rule to read the buffer stream of the file and later in code you can handle the buffer as a file with proper extension if you want to store the file elsewhere, However the question is what sort of encoding you want to apply once you read the file from the directory?
why we need a file listner here?
filelistener will just listen whether there are any files in that particular location or not , but how come it will be used here .
Could you please explain your thoughts in detail.
Hi Suresh,
Sorry for the delay.
1) Filepath control uploads files to Service export folder.
2) In my tomcat server, I can able to see the files whatever I have uploaded using the control in the below location.
C:\GCS\Temp\PRPC718\StaticContent\global\ServiceExport
Like that, please log in to your server and find for ServiceExport folder.
Thanks,
Prudhvi
Thanks Prudhvi, Helpful response from you.
Could you please tell which function in the "FilePath" script does this action to upload file to export path ? what are are the parameters required to upload a file.
I am using file path control in UI but the pyfileupload is not getting updated in requestor page.I am seeing null on pyFileUpload property.
Do we need to call any OOTB for a file to get saved to service export path. Suggest on this.
Thanks,
Suresh
We need not call any OOTB for a file to get saved to service export path and no parameters are required to upload a file.
On using Filepath control in the section, it is saving the files to Service Export folder.
I am not good at java but I suspect the below code is responsible for file upload to export path.
pega.u.d.registerOnBeforeSubmit(saveLocalFilePath, {thisId:"<p:r n='$this-name' m='NORMAL' />", targetId:"hiddenFilePath"})


Pegasystems Inc.
US
Hi Suresh
TRy this
If you have a button for "upload" call refresh section before you call the upload activity. Thsi will ensure the value is posted to the server.
another option would be to over ride the control , add a "onchange" event directly to the tag and call refresh / reload cell via JS function.
Hello,
Please have a look on the below link:
https://pdn.pega.com/community/pega-product-support/question/how-upload-file-remote-location
Thanks.