Execute HTTP Post request for every binary from Webhook node

Describe the issue/error/question

A Webhook node receives Post requests from a form. The payload contains zero or multiple files. For every binary in one request I want to execute a HTTP request node. The target of the HTTP request allows only one file per request and the key for the file must always be ‘file’.

The HTTP Request node works when I select manually a single binary but I don’t know how to loop over the binaries from the Webhook (and regardless the file name) and execute the HTTP request for every file (if one exists).

I checked several other topics about this question here but it seems I’m not smart enough to understand what the solution is.

Many thanks!

Information on your n8n setup

  • n8n version: 0.158.0 (n8n Cloud)

Hi @Gould, welcome to the community :tada:

Based on your description it sounds like you’re looking for this snippet (Split binary data into individual items) for the Function node.

It would convert a single item with multiple binary files (like in your screenshot) into multiple items with a single binary file each. The HTTP Request node could then run once for each item and process a single file each time.

Let me know if you run into any trouble with this!

@MutedJam Thank you so much! I didn’t know that it was so easy.

1 Like