# HTTP request with imagefile

**URL:** <https://discourse.nodered.org/t/http-request-with-imagefile/47673>\
**Category:** General\
**Created:** [25 June 2021 16:05 UTC](https://discourse.nodered.org/t/http-request-with-imagefile/47673 "2021-06-25T16:05:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![CodingMonkey](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/codingmonkey/32/43903_2.png) [@CodingMonkey](https://discourse.nodered.org/u/CodingMonkey)\
**Post date:** [25 June 2021 16:05 UTC](https://discourse.nodered.org/t/http-request-with-imagefile/47673/1 "2021-06-25T16:05:42Z")

</div>

Hello,

how can I set up a HTTP request node to send an image file, according to this curl request?

```auto
curl -F "imagefile=@/data/image.jpg" http://localhost:5003/process

```

Is that possible?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [25 June 2021 16:53 UTC](https://discourse.nodered.org/t/http-request-with-imagefile/47673/2 "2021-06-25T16:53:04Z")

</div>

Yes. Use a file node to read the file (set to return buffer), link that to http request with URL set to `http://localhost:5003/process`

---

<div class="post-metadata">

**Author:** ![CodingMonkey](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/codingmonkey/32/43903_2.png) [@CodingMonkey](https://discourse.nodered.org/u/CodingMonkey)\
**Post date:** [25 June 2021 17:25 UTC](https://discourse.nodered.org/t/http-request-with-imagefile/47673/3 "2021-06-25T17:25:10Z")

</div>

@Steve-Mcl: Should I set the the output of the file node to "a single Buffer object" or "a stream of Buffers"? But both settings doesn't work. And do I have to specify somewhere the key name "imagefile"?

---

<div class="post-metadata">

**Author:** ![CodingMonkey](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/codingmonkey/32/43903_2.png) [@CodingMonkey](https://discourse.nodered.org/u/CodingMonkey)\
**Post date:** [25 June 2021 18:28 UTC](https://discourse.nodered.org/t/http-request-with-imagefile/47673/4 "2021-06-25T18:28:08Z")

</div>

@Steve-Mcl : My flow looks like this at the moment. But it doesn't work, somehow I'm thinking I have to specify somewhere the "imagefile" parameter identifier:

```auto
[{"id":"6460dac4.1ebc14","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"7a1b7ee6.44bc3","type":"debug","z":"6460dac4.1ebc14","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":80,"wires":[]},{"id":"d716027.0824e","type":"http request","z":"6460dac4.1ebc14","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"http://localhost:5003/process","tls":"","persist":false,"proxy":"","authType":"","x":470,"y":80,"wires":[["7a1b7ee6.44bc3"]]},{"id":"d3274f5.a3708b","type":"file in","z":"6460dac4.1ebc14","name":"","filename":"/data/image.jpg","format":"","chunk":false,"sendError":false,"encoding":"none","x":280,"y":80,"wires":[["d716027.0824e"]]},{"id":"6a54fcd4.c57b44","type":"inject","z":"6460dac4.1ebc14","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":80,"wires":[["d3274f5.a3708b"]]}]

```

The log from the server tells me:

```auto
400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
Error: Not recognized file parameter, needs to be files or imagefile

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 June 2021 09:44 UTC](https://discourse.nodered.org/t/http-request-with-imagefile/47673/5 "2021-06-26T09:44:26Z")

</div>

Maybe you could adapt this solution: [File Upload using HTTP Request node (flow) - Node-RED](https://flows.nodered.org/flow/cbf44e064b9406a1175a7e8d589f66ac)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [25 August 2021 09:45 UTC](https://discourse.nodered.org/t/http-request-with-imagefile/47673/6 "2021-08-25T09:45:03Z")

</div>

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