Hello,
I'm having trouble with letting the user enter a png file in a request originating from a yaml template in assembler and then uploading to either a CIFS folder, sending it as email or sending it in the message the approver sees in the assembler.
I have managed to send a png file in an email however the picture is always corrupted.
This is the relevent parts of the script:
var message = new EmailMessage("TLSv1.2");
message.addMimePart("The Information requested is attached in the email","text/html; charset=UTF-8");
var input_mime = inputProperties.requestInputs["fileUpload_14732903"];
var decodedContent = System.getModule("com.vmware.util").encodeAndDecodeBase64(input_mime["content"],"decode");
message.addMimePart(decodedContent, input_mime["mimeType"]);
message.sendMessage();
This is what input_mime looks like when i stringify it:
{"name":"cpu and ram.PNG","mimeType":"image/png","content":"encodedstringoftheimage"}
The action encodeAndDecodeBase64 is an action i found in google and it decodes a text file without a problem. I have also tried running it without decoding the content of the file but it still says the file is corrupted.
When sending a text file instead of a png file, everything works without a problem so I know its something im not doing right with the png file.
I tried saving it in a CIFS folder using PowerShell commands but from what O understood I need to save the image locally in VRA and I cant figure out how to do that as the api command of /api/upload doesn't exist for me.
I'm experiencing the same problem when trying to show it in the inbox of the approver in VRA.
Thank you in advance for the help