Results 1 to 6 of 6

Thread: Get size of a file from the web

  1. #1
    rsitogp
    Guest

    Talking Get size of a file from the web

    Can someone help me, I want to get the size of a file I want to download, I don't care if it's via inet or winsock control.

    i.e. get size of http://www.anysite.com/dir/file.zip

    Thanks In Advance!

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    I believe a server might tell you that with an HTTP HEAD request, but I'm not sure.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3
    rsitogp
    Guest
    I know that info comes in the http header but how do I read it?

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Use the Winsock control to connect to the HTTP server and send the following text:
    "HEAD /dir/file.zip HTTP/1.0" & vbcrlf & vbcrlf

    Then parse the text it sends back for the file size.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  5. #5
    rsitogp
    Guest
    Can you please give me a full code exapmle?

  6. #6
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Here's some code that uses the winsock control. It's not that hard to use.
    Attached Files Attached Files
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width