EspCam Telegram

Hallo zusammen,

könnte mir bitte jemand diesen Code erklären?

String head = "--RandomNerdTutorials\r\nContent-Disposition: form-data; name="chat_id"; \r\n\r\n" + CHAT_ID + "\r\n--RandomNerdTutorials\r\nContent-Disposition: form-data; name="photo"; filename="esp32-cam.jpg"\r\nContent-Type: image/jpeg\r\n\r\n";
String tail = "\r\n--RandomNerdTutorials--\r\n";

Es ist ein Ausschnitt aus diesem Tutorial. Ich hab bisher nirgends eine Antwort bekommen.

Vielen Dank für eure Mühe.

VG Claus

The code simply defines two Strings of ASCII data, named "head" and "tail", probably intended to be sent or posted somewhere.

Thanks for your answer. I try to write in english… what makes me suspisious is that the name of the author is mentioned in the code. I dont want the pictures sent to his server. Can you explain why the author is mentioned and what this part „RandomNerdTutorials“ does?

Kind regards


Perhaps the author was just showing an example of code intended for his/her own application, and expects you to change those details for your own purposes, or remove them. There is no need for you to advertise "Random Nerd Tutorials".

The Telegram Bot library mentioned in the article contains a file, which explains some of the details on how to use it.

A download link is included in the article. But this comment is obvious nonsense:

Du findest sie im Bibliotheksverwalter der Arduino IDE –diese kann jedoch veraltet sein. Deshalb empfehlen wir dir, die Bibliothek hier bei uns herunterzuladen.

Ok thanks for your help. If I got you right, I can replace the author by „Blindfisch“ and the Code will still work. Right?

Try it and let us know what happens. It is just a String, although I see no author name in what you posted.

Here is the correct and complete code for the String "head", taken from that article:

const char* ssid = "NETWORK";
const char* password = "PASSWORD";
String BOTtoken = "TOKEN";
String CHAT_ID = "USERID";

String head = "--RandomNerdTutorials\r\nContent-Disposition: form-data; name=\"chat_id\"; \r\n\r\n" + CHAT_ID + "\r\n--RandomNerdTutorials\r\nContent-Disposition: form-data; name=\"photo\"; filename=\"esp32-cam.jpg\"\r\nContent-Type: image/jpeg\r\n\r\n";

void setup() {
  // put your setup code here, to run once:
  while (!Serial);


void loop() {
  // put your main code here, to run repeatedly:


and here is what that code prints out on the serial monitor:

Content-Disposition: form-data; name="chat_id"; 

Content-Disposition: form-data; name="photo"; filename="esp32-cam.jpg"
Content-Type: image/jpeg

„RandomNerdTutorial“ ist the author of the code. So I will try to replace „ RandomNerdTutorial“ by „Blindfisch“ and I will tell you if it works. Thanks for your help.

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