# ESP32CAM JPEG Upload to Node-Red Server

**URL:** https://discourse.nodered.org/t/esp32cam-jpeg-upload-to-node-red-server/38443
**Category:** Developing Nodes
**Created:** [3 January 2021 07:18 UTC](https://discourse.nodered.org/t/esp32cam-jpeg-upload-to-node-red-server/38443 "2021-01-03T07:18:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Warlock2020](https://avatars.discourse-cdn.com/v4/letter/w/58f4c7/32.png) [@Warlock2020](https://discourse.nodered.org/u/Warlock2020)
#### Post date: [3 January 2021 07:18 UTC](https://discourse.nodered.org/t/esp32cam-jpeg-upload-to-node-red-server/38443/1 "2021-01-03T07:18:50Z")

</div>

Hello everybody,

I have the following script, which sends an image to the Node-Red Port every 10 seconds: XX.XX.XXX.XXX:1880/imageUpdate

I would like to receive and save the images via Node-Red logic later for further processing and image recognition logic.

ESP32CAM coding: [https://hastebin.com/ejewutadoj.js](https://hastebin.com/ejewutadoj.js?fbclid=IwAR1aPKSNEEDl7o6FbPGwYPBgDlp9N8JGRtL1YbB8pt5uhPP2oaI8O1dG0aY)

I created the flow below as a starting point.

The requests arrive somehow, but the images cannot be saved.

When I use instead of Node-Red just a simple Node.JS script with another port 8880 and post the image in that ESPCoding to that Port, the image can be correctly posted and saved.

Node-Script: [https://ghostbin.com/paste/BiwjB](https://ghostbin.com/paste/BiwjB?fbclid=IwAR3Extb0RWynf1tZoI-nIabGgpRI1HpvJBLubjIW3V0Tf5a3Svce8cgQwlk)

Does anyone have a template where pictures can be received from an ESP32Cam using the HTTP Post Request?

Is the "File" node correct when the images arrive in Node-Red, can I then save the files directly to a folder or do I need to convert them first to another format?

Its right, the HTTP image posts need to be posted to Port 1880?

in the debug section I can see the message:

\<Input should be a buffer or a base64 string or a Jimp image (containing a jpg or png image)\>

 ![2021-01-03_07-58-46](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/c/fc948c2dddeb66ba44c3855da81207a7f0e55400.jpeg)

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [3 January 2021 08:11 UTC](https://discourse.nodered.org/t/esp32cam-jpeg-upload-to-node-red-server/38443/2 "2021-01-03T08:11:05Z")

</div>

Hi Markus,

Welcom to our forum!

The msg.payload of your input message contains a _ **string** _. But the _node-red-contrib-image-output_ expects the images to arrive (like you see in your debug panel) as _ **Buffer** _ or as _ **base64 encoded string** _. Seems to me that your image is a string, but not base64 encoded.

Not sure how to solve this:

- do a base64 encoding in your esp32 script (if possible...)
- convert the string to base64 (via the base64 node) in Node-RED
- convert the string to a buffer in Node-RED
- ...

Hopefully somebody else can jump in now ...  
Bart

---

<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: [4 March 2021 08:11 UTC](https://discourse.nodered.org/t/esp32cam-jpeg-upload-to-node-red-server/38443/3 "2021-03-04T08:11:06Z")

</div>

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