Httprequest multiple files to send - POST

I’m experiencing an issue in n8n with the httpRequest node when trying to send multiple binary files in a single request. The goal is to upload multiple files at once in a multipart/form-data structure, but I’m encountering difficulties getting it to work correctly with binary data. I need a way to ensure each file is recognized properly in the payload, but I haven’t found an effective approach that n8n’s httpRequest node will accept.

What is the error message (if any)?

The httpRequest node returns a 415 Unsupported Media Type error, which suggests the format or structure of the multipart/form-data body may not be accepted by the endpoint.

  • n8n version: 1.62.6
  • **Database: Post
  • **Running: Docker
  • **Operating system: Linux

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @Celso_Miranda

You don’t have a file binary, you should specify it as file0 and add another entry with file1

They are dynamic, that is, I don’t know how many will arrive. It could be 2 or even 10.

In that case better to split files into different items and upload them as separate items. E.g. if you have input with file0, file1, file2 then you’ll need to split them as different items with file binary name.

I understand your approach, I did it here, but it only sends the first file, the second one is not sent.

I need to keep the httprequest this way, otherwise it requests more than once, and makes the post call incorrectly. Creating a call for each binary, which is incorrect.

Yes, that’s how I’ve planned it to be used. One call per binary file. n8n does not provide an option to attach multiple dynamic files within one form-data query.

Maybe it’s possible to do with a JSON payload, but you’ll need to manually construct it somehow (I’m not familiar with the syntax, but you can see what it looks via dev console, F12 >> console tab)

Sending multiple files dynamicly (not knowing the amout of input files) can be a bit tricky within n8n. In most cases I would recommend uploading them by a different endpoint (if possible) and then just reference the images path as array. Or depending what the workflow is made for: upload the files to a service like google cloud storage → get the public url of the images and then also just refer it to the inital service where you want to have the pictures ( if supported).

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.