binary content as file in pega
I have file content stored as FileData column in text format.
I want to open file when that file name is clicked to shoe the filedata content opened as File.
I followed many pega support forums and followed followin glink but it is not working.
https://support.pega.com/question/how-show-binary-content-file-pega?
I did following...
String fileDataString = tools.getParameterPage().getParameterValue("FileData").toString(); byte[] byteArray = java.util.Base64.getDecoder().decode(fileDataString);
// Get the PDF name, extension, and location from the parameter page String fileName = tools.getParamValue("FileName"); String fileExt = tools.getParamValue("FileExt"); // Unused but may be needed String fileLoc = tools.getParamValue("FileLoc");
String sErrorMessage = tools.sendFile(byteArray,fileName,false,null,true); //String sErrorMessage = tools.sendFile(byteArray, fileName, true, null, fileLoc, false, null, true);