Как отправить фото из формы в телеграм

Для команды sendPhoto требуется аргумент photo, определенный как InputFile or String inputFile как я могу передать в этот аргумент фото из input?

let file = [$inputFile]

const photoUrl = `https://api.telegram.org/bot${token}/sendPhoto?chat_id=${chatId}&photo=${file[0].files}`

var request = new XMLHttpRequest();
request.open("POST", photoUrl, true);
request.send();

Спасибо за ответ!


Ответы (0 шт):