I would like to convert the Image attachment uploaded by a user, validating with its extension and convert it into a binary file into application's binary file directory to use it in it's post upload process. can anyone suggest how to achieve it . Thanks in advance.
***Edited by moderator, Maryrita: Moved to Product Support from Applications***
Pega uses Base64Utils class to convert the data into the bytearray with the help of encode and decode methods in it. You can look into the Base64Utils class methods and use the appropriate one. For further information kindly refer SendEmailMessage function where the email attachments are converted into the bytearray. pyAttachStream property is used to capture Attachment stream encoded to Base64. You can write a temp file using this bytearray or stream invoking java.io library. Once the file is created you can use sendFile API to keep it in required directory.