VMware Aria Automation Orchestrator

 View Only
  • 1.  FileUpload Parameter in vRO 8.1

    Posted Jul 13, 2020 07:11 AM

    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



  • 2.  RE: FileUpload Parameter in vRO 8.1
    Best Answer

    Broadcom Employee
    Posted Jul 13, 2020 09:37 AM

    Hi,

    One option is to add workflow input parameter of type MimeAttachment.



  • 3.  RE: FileUpload Parameter in vRO 8.1

    Posted Jul 13, 2020 09:52 AM

    Thank you, exactly what I've looked for!



  • 4.  RE: FileUpload Parameter in vRO 8.1

    Posted Oct 12, 2023 10:44 PM

    Hello, 

    I have the same situation as you after 3 years, i couldn't decode the content or store the file, show it to users (which item that i can use to PDF reader), any idea or help ? Thanks



  • 5.  RE: FileUpload Parameter in vRO 8.1

    Posted Oct 13, 2023 07:17 AM

     

    Hello Arar,

    a detailed explanation how to handle this is here available:

    https://communities.vmware.com/t5/VMware-Aria-Discussions/upload-File-item-in-service-broker-how-to-use-it/m-p/2990176#U2990927

    Best regards
    Stefan



  • 6.  RE: FileUpload Parameter in vRO 8.1

    Broadcom Employee
    Posted Jan 04, 2026 02:04 PM

    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
    ------------------------------