HTTP request with imagefile

Hello,

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

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

Is that possible?

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

@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"?

@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:

[{"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:

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

Maybe you could adapt this solution: File Upload using HTTP Request node (flow) - Node-RED

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