By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,680 Members | 1,486 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,680 IT Pros & Developers. It's quick & easy.

How to get size of file on server?

P: n/a
How would I get the size (In bytes or kilobytes) of a file on a typical HTTP
web server. For example, I would like to get the file size of this file:
http://www.virtualwareproducts.com/v...adisksetup.exe

-Jason
Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
try down loading the file and check its properties!

"ViRtUaLpCwHiZ" wrote:
How would I get the size (In bytes or kilobytes) of a file on a typical HTTP
web server. For example, I would like to get the file size of this file:
http://www.virtualwareproducts.com/v...adisksetup.exe

-Jason

Jul 21 '05 #2

P: n/a
Might require a bit of trial and error, but you should be able to make the
HTTP GET request and then grab the Content-Length: attribute off the
server's header response without having to download the actual file...

Perhaps you could create a new TCP socket connection and connect to
www.virtualwareproducts.com on port 80, then once connection is established,
send:

GET /virtuadisk/virtuadisksetup.exe

Server should return something similar to this at the beginning:

Date: Sun, 02 Jan 2005 00:00:27 GMT
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 1515

Then only listen for a couple hundred bytes and parse Content-Length out of
it (regular expressions?), then terminate the connection.

HTH,
Brandon

"ViRtUaLpCwHiZ" <Vi***********@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
How would I get the size (In bytes or kilobytes) of a file on a typical HTTP web server. For example, I would like to get the file size of this file:
http://www.virtualwareproducts.com/v...adisksetup.exe

-Jason

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.