Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Programming Talk / Delphi - Finding File Size Of Web Files?

Author
Message
The Lone Programmer
22
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 30th Jan 2006 04:14
Hello,
When downloading a file from the internet with the assistance of say AdvHttp or Indy Http how would I check to see the file size before I download it.

I know it is not random because when I use Internet Explorer it is pretty freaken accurate the progress bar.

What is the best possible solution for finding the file size of a remote file? Is there a command or a recommended third party command I should get?


Thanks,
The Lone Programmer

"Is The Juice Worth The Squeeze"
-The Girl Next Door
Sergey K
21
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 30th Jan 2006 12:58
hey
ill tell you exactly what a guy told me when i was programmed in vb.net

you cant get a file size from URL unless you will download the file.
so you need to read all the file to get the file length.

Paisleys finest
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: In a house
Posted: 30th Jan 2006 14:35 Edited at: 30th Jan 2006 14:38
You can get a file size without downloading the file!

if you were to click on a hyperlink to download an .exe for example you'd see a messagebox (in SP2) from Windows saying "Do you want to run or save this file?" with the size, in K, of the file displayed beneath.

The file is not downloaded to your hard disk at that point!!!

Here's how to get file length in VB - note the Win32 internet functions, you'll need them in Delphi:

http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnarwebtool/html/msdn_vbhttp.asp


The ContentLength tells you the size of the file you are downloading... you don't NEED to download the file at all


[EDIT: .NET rubbish removed lol]

Current work in progress: Retro Remake of BRUCE LEE, by Datasoft (1984)
Paisleys finest
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: In a house
Posted: 30th Jan 2006 14:41


Current work in progress: Retro Remake of BRUCE LEE, by Datasoft (1984)

Login to post a reply

Server time is: 2025-05-22 08:28:20
Your offset time is: 2025-05-22 08:28:20