Jump to content
Shrinavat

Clever Internet Suite and AddSubmitFile method

Recommended Posts

Hello,

I know there are advanced Clever Internet Suite users here who might be able to help me with advice.

To send an image to a Telegram channel, I use the following code:

const
  urlTGSendPhoto   = 'https://api.telegram.org/bot%s/sendPhoto';
  BOT_API_KEY      = 'xxxxxxxxxxxxxx';
  CHANNEL_NAME     = 'xxxxxxxxxxxxxx';  
...
clHttpRequest.AddFormField('chat_id', CHANNEL_NAME);
clHttpRequest.AddSubmitFile('photo', 'chart.png');
var s := clHttpTG.Post(Format(urlTGSendPhoto, [BOT_API_KEY]), clHttpRequest);

where 'chart.png' is the name of the image file on disk. It works great.

Can someone please tell me how to use a stream (TMemoryStream/TFileStream) or TPngImage/TJPEGImage/TBitmap instead of a file (that is, without the need to save the file to disk)?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×