how to make a telegram file accessible from public internet for downloading
miannoodle01 opened this issue · comments
Hello! I was just looking for a solution to make a telegram file which user sends to bot public on the internet for downloading in purpose of making a file to link bot. Thanks for help!
Hi!
Currently it works like this. You send for example a document to the bot. Then the bots receives a Document object. You then take the Document::fileId
of this document and save it for later. Next, you prepare the file for downloading via Api::getFile()
. This function returns the File::filePath
of said document.
Remember, this filePath
will be valid for at least 1 hour and the maximum file size to download is 20 MB.
The file is now downloadable via this link: https://api.telegram.org/file/bot<token>/<filePath>
So there is no way to upload a file to else where without downloading it?
Not that I know of. The only thing that spontaneously comes to mind is that you're not downloading the file via the link but via Api::downloadFile
. The function returns the file content as a string. Then you have the content and can upload it to another server as you like.
okay man, thanks to you!