Skip to content

File uploading addition #7

@vlabella

Description

@vlabella

libTelegram is working fine for me on windows. Sends messages ok. I was uploading files as well by sending the URL and letting the telegram server pull the file from my server. However now I want to directly upload the image file. It seems the library does not support this yet. Can you give me some pointers on how to implement. I am experienced C++ programmer. Thanks

for example I have tried with no luck

telegram::sender sender(MyToken);
telegram::types::file f;
// slurp the file into file_id??
std::ifstream t("image.png");
f.file_id = "";
t.seekg(0, std::ios::end);
f.file_id.reserve(t.tellg());
t.seekg(0, std::ios::beg);
f.file_id.assign((std::istreambuf_iterator(t)),std::istreambuf_iterator());
sender.send_photo(123456789,f,"this is your image");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions