How do I put a file with the Http Request component?

Hi, I just got started with n8n. I’m trying to build a test workflow that reads a single file from Dropbox and then uses a HTTP PUT to send the file to another url.

The Dropbox component works fine and retrieves the file and stores it in a binary property called “data”. But I am unable to configure the Http Request component to upload the file.

Here’s what I have so far:

{
      "parameters": {
        "requestMethod": "PUT",
        "url": "http://host.docker.internal:9998/tika",
        "responseFormat": "string",
        "jsonParameters": true,
        "options": {
          "bodyContentType": "raw"
        },
        "bodyParametersJson": "data"
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        730,
        300
      ]
    }

This works, but it just uploads the string “data” instead of the contents of the file. I tried a bunch of other request settings but I haven’t been able to get it to work yet.

Sending a file to the service using “curl -T http://localhost:9998/tika” works fine so I know the service is running. I just need to reproduce exactly what curl does in n8n.

Is there documentation somewhere on how to upload files with the Http Request component? I feel like I’m overlooking something very simple. I could use a custom function but I feel the Http Request component should be able to do this.

Thanks!

First welcome to the community!
Yes, you are sadly right. The HTTP Request-Node does really not have the possibility right now to upload binary data. I will have a look and try to implement it. Will inform you once it is done and a new version with it got released.

1 Like

Wow thanks!

Which workaround would you advise for me right now? Should I use a function instead?

Yes guess that is the only thing that is possible. With allowing access to the “request” module:

Ok programmed it and released with [email protected]

As the original node-design did not get planned with it in mind, it is sadly not the most obvious. Anyway, for now, it at least works. It can then get improved in future versions of the node. Here an example:

Thanks! I’ll upgrade my installation and try it out.

Great! Tell me if you have problems.

@mdfarragher does it work fine?