Open sfekilou opened 3 years ago
I can confirm that! I was unable to send files on an ESP32 (sdk v3.3.5-1-g85c43024c). Sending a file gives response:
[E][ssl_client.cpp:36] _handle_error(): [send_ssl_data():301]: (-80) UNKNOWN ERROR CODE (0050)
Solution (found here: https://www.gitmemory.com/issue/espressif/arduino-esp32/4666/808756058 ): Replace "client->println(F(""));" by "client->println();" in UniversalTelegramBot.cpp, because sending an empty string seems not to work as expected.
Now the ssl error is gone and files are actually sent.
Update: Solved by #236. @sfekilou please use latest lib version and close this issue
cheers
I wanted to use the function sendMultipartFormDataToTelegram to send a text file. So I made this call to the function:
String response=bot->sendMultipartFormDataToTelegram("sendDocument","document","mesures.txt",X,Chat_id,size,isMoreDataAvailable,getNextByte,nullptr,nullptr);
I didn't know what to put in the X chain. I tried with "image/png" instead of X:String response = bot-> sendMultipartFormDataToTelegram ("sendDocument","document","mesures.txt","image/png",chat_id,size,isMoreDataAvailable,getNextByte,nullptr,nullptr);
Then, on executing, the function blocked. While debugging, I noticed that the function sendMultipartFormDataToTelegram of UniversalTelegramBot.cpp was blocking at the level of the call to client->println(F("")); I replaced this line by: client->print(F("\r\n")); (note: "print" instead of "println" !). It works now, I received my file. And it also works with "" instead of "image/png".Note: you must add these functions in your main code:
and open file before calling sendMultipartFormDataToTelegram function: