Get File Size Information Before You Download
Hello,
I was browsing ASP.NET resources and found an interesting code snippet for getting a file’s size over HTTP before the download actually starts.
So you can find out the size of a file before you download it. Here’s the simple code:
string completeUrl = "TypeYourDownloadableURL";
WebClient obj = new WebClient();
Stream s = obj.OpenRead(completeUrl);
Response.Write(obj.ResponseHeaders["Content-Length"].ToString());
s.Close();
obj = null;