[QUESTION] How to sendLocalFiles?
apepenkov opened this issue · comments
apepenkov commented
Stream stream = new MemoryStream(File.ReadAllBytes(@attachment));
var dct = new Dictionary<string, Stream>();
dct.Add(attachment, stream);
msg_uid = await client.sendLocalFiles(dct, message, user, ThreadType.USER);
Is wrong, because throws errors.
fbchat_sharp.API.FBchatException
Error: Message: Some files could not be uploaded: {
"uploadID": null,
"metadata": []
}
apepenkov commented
attachment
is a full path to file
Marco Gavelli commented
Hello the following works for me, both from netcore and WPF app.
// Send a local image to myself
using (FileStream stream = File.OpenRead(@"C:\Users\BLABLA\test_image.jpg"))
{
await Client.sendLocalImage(@"C:\Users\BLABLA\test_image.jpg", stream, null, Client.GetUserUid(), ThreadType.USER);
}
apepenkov commented
that's localImage, i need any file
apepenkov commented
and it throws
Error: Message: Some files could not be uploaded: {
"uploadID": null,
"metadata": []
}
Marco Gavelli commented
I can send a pdf with the following. What kind of file are you trying to send?
using (FileStream stream = File.OpenRead(@"C:\Users\PATH\a032.pdf"))
{
await client.sendLocalFiles(
file_paths: new Dictionary<string, Stream>() { { @"C:\Users\PATH\a032.pdf", stream } },
message: null,
thread_id: client.GetUserUid(),
thread_type: ThreadType.USER);
}
apepenkov commented
thanks