I'm new in c#,and write this code:
const string file ="http://ipaddress/"+"1.jpg";
var fileName = file.Split('\\').Last();
using (var fileStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
var fts = new FileToSend(fileName, fileStream);
await Bot.SendPhotoAsync(update.Message.Chat.Id, fts, "Nice Picture");
}
but in this line:
using (var fileStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
get this error:
URI formats are not supported
How can i solve that problem ?thanks.
I'd suggest you use WebClient instead of FileStream
for this. Here's a link that might help you: URL Formats are not supported
Hope it helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.