How to get the download or upload size
-
i wan to get the total download size of a download or upload done using QtNetwork
QNetWorkReply , QNetWorkRequest etc.
i am able to download but not to able to get the download size
QNetWorkReply in its signal downloadprogress()
but i want before download or even i cant do it after download starts without using that signal this signal is not the right way
i have tried QNetWorkReply->bytesToWrite();QNetWorkReply->size();
none worked i have seen the download manager example http://qt-project.org/doc/qt-4.8/network-downloadmanager.html
and the bittorrent example too.
and this easy example too http://kunalmaemo.blogspot.in/2011/07/simple-download-manager-with-pause.html
i am sure there's a way -
This is not an easy issue.
Try to start from "here":http://www.codeproject.com/Articles/9016/Quick-and-Dirty-Series-C-FileSize-function.
(ifstream::tellg() section) -
Can you not just use the ContentLength http header?
-
hey broadpek i want a qt way
zapb can you tell more info a sample code will be great -
"QNetworkReply::header(QNetworkRequest::ContentLengthHeader) ":/doc/qt-4.8/qnetworkreply.html#header is what ZapB suggested. Be aware that not on every request a content length header is sent!