I have created a solution for this in TypeScript using the Aria Build Tools
https://github.com/vmware/build-tools-for-vmware-aria
public FileSave(objMimeAttachment: MimeAttachment): boolean {
let objFile: File = this.FileGet(objMimeAttachment.name);
let blnResultDelete: boolean = this.FileDelete(objMimeAttachment.name);
if (blnResultDelete === true) {
let blnResultWrite: boolean = this.FileWrite(objMimeAttachment);
if (blnResultWrite === false) {
return false;
}
else {
return true;
}
}
else {
return false;
}
}
public FileCanWrite(objMimeAttachment: MimeAttachment): boolean {
let objFile: File = this.FileGet(objMimeAttachment.name);
return objFile.canWrite();
}
public FileCanRead(objMimeAttachment: MimeAttachment): boolean {
let objFile: File = this.FileGet(objMimeAttachment.name);
return objFile.canRead();
}
public FileWrite(objMimeAttachment: MimeAttachment): boolean {
let strTempDirectory: string = System.getTempDirectory();
try {
objMimeAttachment.write(strTempDirectory, null);
return true;
}
catch {
return false;
}
}
public FileDelete(strFileName: string): boolean {
let objFile: File = this.FileGet(strFileName);
if (objFile.exists) {
try {
objFile.deleteFile();
return true;
}
catch {
return false;
}
}
}
public FileExists(strFileName: string): boolean {
let objFile: File = this.FileGet(strFileName);
if (objFile.exists) {
this.objLogger.info(`File ${strFileName} already exists.`);
}
return objFile.exists;
}
public FileGet(strFileName: string): File {
let strTempDirectory: string = System.getTempDirectory();
let objFile: File = new File(strTempDirectory + "/" + strFileName);
if (objFile.exists) {
return objFile;
}
else {
return null;
}
}
------------------------------
Simon Sparks
Automation & Orchestration Consultant
North West England, UK, Europe
Broadcom Employee
------------------------------
Original Message:
Sent: Jul 13, 2020 07:11 AM
From: LukasWe
Subject: FileUpload Parameter in vRO 8.1
Hi all,
vRO 8 introduced the possibility to upload a file into the input form of a workflow.
I'd like to upload a file and then convert it to a base64-encoded string to use it in a scripting block.
But I don't know which object type to select as input parameter to be able to change the display type to "File Upload". The type "Any" doesn't work unfortunately and plain "object" type cannot be selected. If I just drag the "File Upload" input element from generic elements into the form, a dynamic input ID is created and can partly be referenced. But I still don't know how to retrieve the file or its content from another attribute or in the workflow script itself.
I'd greatly appreciate it if anybody has some hints :smileyhappy:
Regards,
Lukas