Saturday, January 8, 2011

Get file size before downloading using webclient

System.Net.WebClient wc = new System.Net.WebClient();

wc.OpenRead("http://patrickkroft.com/mp3/Pearl.mp3");

Int64 bytes_total= Convert.ToInt64( wc.ResponseHeaders["Content-Length"]);

MessageBox.Show(bytes_total.ToString() + " Bytes");

No comments:

Post a Comment