Link Search Menu Expand Document

Method: messages.uploadMedia

Back to methods index

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

Parameters:

NameTypeDescriptionRequired
business_connection_idstringOptional
peerUsername, chat ID, Update, Message or InputPeerThe chat, can be inputPeerEmpty for bots and inputPeerSelf for users.Optional
mediaMessageMedia, Update, Message or InputMediaFile 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, );