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

// PHP 8+ syntax, use an array on PHP 7.
$MessageMedia = $MadelineProto->messages->uploadMedia(peer: InputPeer, media: InputMedia, );