MadelineProtoDocs/docs/API_docs/methods/messages.uploadMedia.md
2024-05-01 14:53:46 +02:00

1.7 KiB

title description grand_parent parent image redirect_from
messages.uploadMedia Upload a file and associate it to a chat (without actually sending it to the chat) Telegram RPC API Methods https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png /API_docs/methods/messages_uploadMedia.html

Method: messages.uploadMedia

Back to methods index

Upload a file and associate it to a chat (without actually sending it to the chat)

Parameters:

Name Type Description Required
business_connection_id string Optional
peer Username, chat ID, Update, Message or InputPeer The chat, can be inputPeerEmpty for bots and inputPeerSelf for users. Optional
media MessageMedia, Update, Message or InputMedia File uploaded in chunks as described in files » Optional

Return type: MessageMedia

Can bots use this method: YES

MadelineProto Example (now async for huge speed and parallelism!):

if (!file_exists('madeline.php')) {
    copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();

$MessageMedia = $MadelineProto->messages->uploadMedia(business_connection_id: 'string', peer: $InputPeer, media: $InputMedia, );