Connecting Tech Pros Worldwide Forums | Help | Site Map

How to get size of file on server?

ViRtUaLpCwHiZ
Guest
 
Posts: n/a
#1: Nov 22 '05
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

basecamp
Guest
 
Posts: n/a
#2: Nov 22 '05

re: How to get size of file on server?


try down loading the file and check its properties!

"ViRtUaLpCwHiZ" wrote:
[color=blue]
> 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[/color]
Brandon Potter
Guest
 
Posts: n/a
#3: Nov 22 '05

re: How to get size of file on server?


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" <ViRtUaLpCwHiZ@discussions.microsoft.com> wrote in message
news:FCB6C37B-8502-4CF7-9358-F79502C85AFC@microsoft.com...[color=blue]
> How would I get the size (In bytes or kilobytes) of a file on a typical[/color]
HTTP[color=blue]
> web server. For example, I would like to get the file size of this file:
> http://www.virtualwareproducts.com/v...adisksetup.exe
>
> -Jason[/color]


Closed Thread