I need to send a file to Telegram chat wth a bot. It works fine if only to send short files.
What i am doing - I establish SSL connection to server, then make AT+CIPSEND=2048 (max number) and then send multipart/form-data structure . This structure has head, file itself and tail with its place priority . If the size of (head+ file+tail) is no more then 2048 it gets a good answer from the server and i get a message in my Telegram group with the file.
But what If I need to send a longer file then 2048 bytes - how to escape limitation of 2048 bytes?
I tried this construction AT+CIPSEND=2048 > sending…bytes of (head + part1 of file) SEND OK, then another AT+CIPSEND=M bytes > sending… M bytes of (part2 of file + tail) SEND OK.
And then nothing happens, only after some time i get these answers ““504 Gateway Time-out”” for the first sending and " 400 Bad Request" for the second sending. It looks like the server does not take these 2 sendings as a whole message and does not react adequately.
Please let me know what i am doing wrong with CIPSEND command? How to solve this prblem? Thank you.