For my application, I have the need to restrict to a single uploaded file for each decoration area. When I turn off ‘multiple’ in the drag & drop element, it stops working. Am I missing some other setting or configuration of the default element?
Hi @chrisb
Good catch! It’s something we need to improve on that element. We’ll do that asap.
In the meantime, here’s what you can do:
On the workflow on the upload element
After the upload file action, add a true/false split that checks if more than 1 file were uploaded (note: it will be easier if you do the test while the element has the “multiple” option on. you can turn it off afterwards)
If it’s true (more than one file was uploaded), update the variable with the array. In the example below, there are two objects in that array:
If it’s false, wrap the result from the previous action inside createArray
variable.
It will look like this if you test with “Multiple” on:
And like this if you test with “Multiple” off:
When the “Multiple” option is off, the result will be an object so you need to put that object inside an array to make the bindings on the page work.
On the container with the uploaded files
You’ll need to setup similar logic, checking the length of the input file variable and putting the single object in an array when you’re using the element with “Multiple” off:
Does that help?
Oh wow!
At nearly the same time, I submitted a support ticket that had a solution as well.
Hi, it was because the list under the input file was expecting a list and get only one file, so I wrapped the file with an array containing only the file and it works now
I added a capture to show you what I updated