Size of remote file

Started by
3 comments, last by Evil Steve 15 years, 6 months ago
Hi! I am trying to acquire the size of a remote file (accessed via a URL) so I can print that to the user in my download prompt. I checked GetFileSizeEx(), but that seems to be only for local files.
Advertisement
What language and API? How are you downloading the file? If it's via a URL, there isn't necessarily any guarantee the server will tell you the size, it may just keep sending bytes and then close the connection when it's transferred.
The web server may send its size in an accompanying header (content-length). However, like Steve pointed out, there are no guarantees that the information is correct or at all present.
Sorry, I am using WINAPI and C/C++. How would I do to access this header?
Quote:Original post by Eldritch
Sorry, I am using WINAPI and C/C++. How would I do to access this header?
What functions are you using for the network side? WinSock? There's no magical GetFileFromRemoteServer() function that I know of.

The header is sent as part of the HTTP request, which you'll have to parse if you're doing the network code yourself.

This topic is closed to new replies.

Advertisement