'Zapier action with support for multiple files
I have a Zapier Action that currently has support for a single file attachment. I am looking to make the Action support multiple files which are mapped to the same field.
Using the Trello Zapier app as an example, I can see multiple files are supported by separating the different file inputs with a comma. Example:
When using the file
field type the file gets converted into a pointer for later use in the Zap, which I am currently handling.
Ideally I was looking for a solution where I could do what is similar in the Trello app.
I was hoping the following would work and then I could loop over the files and append them to my FormData
.
bundle.inputData.files.split(",")
However this only seems to return the first file that has been mapped to the field.
[
'https://zapier.com/engine/hydrate/:censored:7:3253ac4a5c:/.eJxVzksOgyAQgOG7zFpaUHweohdoGoMwGCKCEUxjjHcvfWy6_WfyzRwgvYvoYh_3BaGDG2RgXIjCSeyNgo7RlrK2rooM5Bain7eA63fCGsoZzUBI6bdE_EVt0KreifmtamMxJHl6inUM0B2f0i_epONrCvcDJtzTZiiuPC-LQmlJhrweCC9zQRrULVGat0wj6krpZP1olZ4X1u7E-tFfFjfC-TjPFyM9RQ4:1lEuaX:GDjfyeC0mtdhdw47AVimeUHfdG4/'
]
Any anyone got a solution that overcomes this problem?
Solution 1:[1]
I managed to this working by setting list: true
on the field in inputFields
.
I can then loop over the file pointers in the perform
function on my action, where I get the file data and filename and append them to a FormData
object. I used this example as a guidance for getting the file data and filename.
{
key: 'files',
type: 'file',
label: 'Attachment',
list: true
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Richard Davies |