How to get a Choose Files button in Embedded Form

Hello.

I need to get the names of files that an user specifies in Camunda form.

I made a embedded form in HTML that I deploy with file .bpm:

<form class="form-horizontal">
  <div class="col-xs-12">
    <div class="form-group">
      <label for="filename">
      Select YAML files to create test cases:
      </label>
      <input class="form-control" name="filename" cam-variable-type="File" cam-variable-name="filename" type="file" multiple>
    </div>
  </div>
  <script cam-script type="text/form-script">
  // custom JavaScript goes here
  </script>
</form>

The first problem is when I go to Cockpit I can only download the first file I chose. How can I download the rest fo the files? Maybe, I am not doing good the HTML form…

The second problem is that I don’t know how to download files by using Camunda External Task Client for Python 3. I usually get task variables by this way:

def generateTest(task: ExternalTask) -> TaskResult:
    #Retrieve filename from inputs form
    filename = task.get_variable("filename")

But this is not downloading the uploaded files… Any idea or help?

Thank you very much!

Hello @josemtnzjmnz ,

for your second question: There two different endpoints for getting serialized data and binary data.

https://docs.camunda.org/manual/7.15/reference/rest/process-instance/variables/get-variable-binary/

This will get you the binary.

Unfortunately, I have never tried to upload multiple files to one variable.

I hope my first advice does help you

Jonathan

Hello @jonathan.lukas ,

I would like to upload multiple files (the way doesn’t mind), if you know another way I am open to listen you.

I don’t understand the documentation of Camunda. What am I supposed to do?

At this moment I am trying to get the file by using task.get_variable(“filename”) function as indicated in my original post, must I use a different function in Python?

Regards, Jose.

Hello @josemtnzjmnz ,

the Python client is written by a community member, so we do not provide any API documentation on this. Please research if you find an already existing function inside the client. Otherwise feel free to create a workaround, create a fork, implement your improvement and then create a PR.

For the multiple file thing, maybe @Niall can provide some input from his experience. He does crazy things with our platform :wink:

I hope this helps

Jonathan