Answer the question
In order to leave comments, you need to log in
How to send a Telegram API BOT file using Delphi?
I'm trying to send a file using the API. Constantly knocks out a 400 error. Tell me what I'm doing wrong?
var
Files: TIdMultiPartFormDataStream;
begin
try
Files:=TIdMultiPartFormDataStream.Create;
Files.AddFile('Document','C:\1.txt','text/plain');
THTTP.HandleRedirects:=False;
THttp.Request.ContentType := 'multipart/form-data';
THTTP.Post(' https://api.telegram.org/bot1234:XXXX/sendDocument... '+'&document', Files);
finally
Files.Free;
end;
Answer the question
In order to leave comments, you need to log in
Link closed. I am sending it.
The response is always the same [Error : 400 : Bad Request: there is no document in request]
As I have not tried it yet.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question