Reputation: 16783
I want to download a file on a website using C# and show its downloading percentage using progressBar. I know I can use the following code to get the size of a local file, but how can I know the size of file posted on a website?
FileInfo finfo = new FileInfo(strFilePath);
int length = (int)finfo.Length;
Upvotes: 1
Views: 2323
Reputation: 10685
When you start the download, the server should send a Content-length
header which will tell you how big the file is.
Upvotes: 3