1

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.

reza rezi
  • 29
  • 1
  • 4

1 Answers1

0

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!

Community
  • 1
  • 1
mindOfAi
  • 4,412
  • 2
  • 16
  • 27