简体   繁体   English

支持多个文件的 Zapier 操作

[英]Zapier action with support for multiple files

I have a Zapier Action that currently has support for a single file attachment.我有一个 Zapier Action,目前支持单个文件附件。 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.以 Trello Zapier 应用程序为例,我可以看到通过用逗号分隔不同的文件输入来支持多个文件。 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.当使用file字段类型时,文件被转换为一个指针,供以后在 Zap 中使用,我目前正在处理它。

Ideally I was looking for a solution where I could do what is similar in the Trello app.理想情况下,我正在寻找可以在 Trello 应用程序中执行类似操作的解决方案。

I was hoping the following would work and then I could loop over the files and append them to my FormData .我希望以下内容可以正常工作,然后我可以将文件和 append 循环到我的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?任何人都有解决这个问题的解决方案?

I managed to this working by setting list: true on the field in inputFields .我通过在inputFields的字段上设置list: true来设法完成这项工作。

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.然后,我可以在我的操作中循环perform function 中的文件指针,在其中我获取文件数据和文件名以及 append 到FormData object。 I used this example as a guidance for getting the file data and filename.我将此示例用作获取文件数据和文件名的指南。

{
    key: 'files',
    type: 'file',
    label: 'Attachment',
    list: true
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM