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)

May also be used in a business connection, not by wrapping the query in invokeWithBusinessConnection », but rather by specifying the business connection ID in the business_connection_id parameter.

Parameters:

NameTypeDescriptionRequired
business_connection_idstringWhether the media will be used only in the specified business connection », and not directly by the bot.Optional
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 users use this method: YES

Can bots use this method: YES

Can bots use this method over a business connection with the businessConnectionId flag: NO

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, );