I want to get the size of an http:/…/file before I download it. The file can be a webpage, image, or a media file. Can this be done with HTTP headers? How do I download just the file HTTP header?
C# – How to get the file size from http headers
cdownloadhttphttp-headers
Related Topic
- Rest – HTTP GET with request body
- Java – How to use java.net.URLConnection to fire and handle HTTP requests
- Java – Download a file with Android, and showing the progress in a ProgressDialog
- Custom HTTP headers : naming conventions
- Are HTTP headers case-sensitive
- Json – How to POST JSON data with cURL
- How does HTTP file upload work
- How are parameters sent in an HTTP POST request
Best Answer
Yes, assuming the HTTP server you're talking to supports/allows this:
If using the HEAD method is not allowed, or the Content-Length header is not present in the server reply, the only way to determine the size of the content on the server is to download it. Since this is not particularly reliable, most servers will include this information.