Once we have uploaded the file in PEGA, it goes in to a temporary storage location(file://web:/StaticContent/global/ServiceExport/) which is got from pxRequestor.pyFileUpload. How to access the actual path of this location?
I need to provide the file path to another function for file type detection.What filepath i need to give and How can i get the actual filepath of the file I have uploaded?
You can use the below code to get the exact file path where uploaded files will be stored in this location. Please find below piece of code to fetch file path. You can form a string as below and can pass the string to the function which expects file path as input for further processing.
String exactFilePath = cpThread+cprequestor+cpProcess+exPath; //which can be passed as a parameter to calling function oLog.infoForced("All uploaded files will be stored in this location "+cpThread+cprequestor+cpProcess+exPath);//log if needed to verify the path generated is correct or not.
I had used the above mentioned code in the java step of a activity.Your code was useful but am facing few issues.
cpThread,cpRequestor,cpProcess are of ClipboardPage type and hence not able to concatenate them and store it in a single string as per the below line
String exactFilePath = cpThread+cprequestor+cpProcess+exPath;//error -->The operator + is undefined for the argument type(s) com.pega.pegarules.pub.clipboard.ClipboardPage, com.pega.pegarules.pub.clipboard.ClipboardPage
I have commented this step alone and tried to execute the remaining.The log message i got was not useful.it contained class name and all.
could you please suggest how can we get the path alone and concatenate into the string?