Using multiple Files (Download) in Forms

Hi guys,

I am trying to set multiple files as download links in an embedded form. One File is not a problem, therefore I am just setting a process var. But I am looking for an easy an fast way to serve multiple links in a form. For example if two files are available, there should be two files to download. Three files three links and so on.

I would appreciate any help. :slight_smile:

Greetings

How does your data-structure look like? Do you have multiple process-variables of type β€œFile” that contain a file each? In that case you can get a list of all variables in the process instance and then check which of those are of type file and display a download link for them.

That would work similarly to how variables are displayed in Cockpit.

Create a variable for storing the count of files at the time you are uploading files.

camForm.variableManager.createVariable({
            name: 'fileUploadCount',
            type: 'Integer',
            value: fileUploadCount
          });
      });

Fetch the value of fileUploadCount from next process and create file-download links dynamically.

for(var i=0;i<$scope.fileCount; i++){
                        y = document.createElement("a");
                        y.setAttribute("cam-file-download", "DOCUMENT_"+i);
                        y.setAttribute("href"," /camunda/api/engine/engine/default/task/"+camForm.taskId+"/variables/DOCUMENT_"+i+"/data");
                        y.innerHTML="download"+i;
                        document.getElementById('fileDownloads').appendChild(y);
                 }
1 Like

@manmohanm can u guide us or if u have any code in GitHub regarding multiple upload and download can u share with us we are trying that requirement it will be help us.