PDA

View Full Version : How to get size file in a link?



tamnv110
29th June 2011, 10:57
I need to download a file on the internet, I use QNetworkManager and QNetworkReply. How do I know which file to download with size is?

Rachol
29th June 2011, 12:48
Use
header(QNetworkRequest::ContentLengthHeader) on your QNetworkReply. You will get content-length.

ChrisW67
29th June 2011, 23:17
If you need to, you can issue a HEAD request to retrieve the headers without actually receiving the content. There may be a "Content-Disposition:" header (see RFC 2183 (http://www.faqs.org/rfcs/rfc2183.html)) that contains the server's recommended file name.