The system API class System.Net.HttpWebRequest allows you to retrieve the file information programmatically. The size of each file/page generally available in the header section of web response, which you can query to get it. Header contains Content-Length property value which gives you the size of the file in bytes. This you can later calculate to […]
Here’s a small function that processes the input file size in bytes to KB, MB, GB. It may be useful if you wish to display well formatted file size instead of showing it in bytes which the users will find difficult to interpret.