I want to send a CSV file created using PHP (and is not stored on the disk) via sendDocument method using multipart/form-data since it has no URL, but didn't find any guide about it.
Can someone plz help?
You should be able to just pass your stream to the document parameter of sendDocument.
Does this work for you? #484
Yes, that worked great!
But when the file is stored on the disk, code below does not work.
$file = file_get_contents('file.xlsx');
$data['document'] = $file ;
$data['chat_id'] = 1234;
Request::sendDocument($data);
You need to send the resource, not contents
$data['document'] = fopen('file.xlsx', 'rb');
Thanks @sharkydog , I will try that out.
Most helpful comment
You need to send the resource, not contents
$data['document'] = fopen('file.xlsx', 'rb');