Embedded form - tabset with file upload(s)

Hello,

I have an embedded form with a tabset that has 5 tabs. I know that based on other posts in the old forum that a tabset can cause issues with the cam variable directives. I have worked around the saving issues for text and checkboxes based on the following.
https://groups.google.com/forum/#!msg/camunda-bpm-users/Qvm-CE-7O4w/GWKA-5XVyt0J

However I have an issue where I want to have multiple file upload fields (one file upload control in each tab). How do I handle the file upload for a tabset? Is the following the best approach?

https://docs.camunda.org/manual/7.4/reference/embedded-forms/javascript/examples/#upload-large-files

Thanks
Greg

Hi Greg,

Based on my own experience, the only way you will get it working is via REST calls, not via the Camunda directives.

I have implemented my own file component directive in an upload tab using these REST calls;

https://docs.camunda.org/manual/7.4/reference/rest/task/variables/

Get (Binary)
GET /task/{id}/variables/{varId}/data

Post (Binary)
POST /task/{id}/variables/{varId}/data

$http.post('/engine-rest/task/' + taskId + '/variables/' + name + '/data', formData,
    {transformRequest: angular.identity, headers: {'Content-Type': undefined}}
);

Thank you very helpful. I will try it out and let you know.

As a reference, here is my topic on the subject;

1 Like

Thank you.

How did you handle the generation of the link to the file to allow someone to dowload? I was having trouble on load of the embedded form if the file upload process variable is not set yet.

I know there is the cam directive but it appears that only works once you have posted a file and the variable is set.

Thanks for the suggestions
Greg

It is a known bug that the file download directive throws an exception when the file variable is not set as a variable.
A workaround is to add it nevertheless with a null value.

This being said you can use a button like this;

<a href="/engine-rest/task/{{camForm.taskId}}/variables/someVariable/data" class="btn btn-default" role="button">
  Download
</a>