Closed anajo333 closed 3 years ago
Your issue is your-server-related. I tried your example with 188mb file on notebook with 16 GB RAM and it went thru PHP just fine. I guess that you are limited by hardware capability provided on your server.
Anyway, even if you would solve out of memory issue, Telegram API is not accepting uploaded files that big, as you can see here: https://core.telegram.org/bots/api#sending-files
Post the file using multipart/form-data in the usual way that files are uploaded via the browser. 10 MB max size for photos, 50 MB for other files.
If you send file bigger than that, Telegram API will respond with:
413: Request Entity Too Large
And this library will throw this exception:
\unreal4u\TelegramAPI\Exceptions\ClientException: Request Entity Too Large #413
If you try something smaller (for example 2.9 MB) PHP will upload it correctly and Telegram will accept it as it should. Only solution that came up in my mind is using recently introduced Local Bot API Server, which increasing limit up to 2000 MB. According issue #129 it should be possible with this library but I didn't tested it, yet.
Very good answer @DJTommek ! Thanks for answering this!
Hello, i using a lastest version from telegram-api
I want to upload video 192MB and send it to my channel with
examples/send-video.php
i change$sendVideo->video = new InputFile('binary-test-data/demo-video.mp4');
to my file but this error faced mefatal error: out of memory (allocated 1613365248) (tried to allocate 201413288 bytes) in /home/ooo/public_html/2/src/InternalFunctionality/PostOptionsConstructor.php
I added
in the top of scripts like
And this error still faced me i tryed on too many servers There's any solve for this problem