Jump to content
  • Advertisement
Sign in to follow this  
Eldritch

Size of remote file

This topic is 3633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!