Any body knows filecatalyst...am using fileCatalystCL.jar. for downloading .



  • can u please tell me how to get the size of file by using url


  • Moderators

    Hi,

    I'm not sure about the fileCatalystCL.jar but you could use QNetworkAccessManager to get the size of the file by checking the QNetworkRequest::ContentLengthHeader.



  • yes i used the same...
    QVariant fileSizeVar = reply->header(QNetworkRequest::ContentLengthHeader);
    long long fs = fileSizeVar.isValid() ? fileSizeVar.toLongLong() : 0;



  • QEventLoop eventLoop;
    manager = new QNetworkAccessManager(this);
    reply = manager->head(QNetworkRequest(assetUrl));
    connect(reply, SIGNAL(finished()), &eventLoop, SLOT(quit()));
    eventLoop.exec;

    QVariant fileSizeVar = reply->header(QNetworkRequest::ContentLengthHeader);

    qDebug() << "filesizeVar"<< fileSizeVar;
    long long fs = fileSizeVar.isValid() ? fileSizeVar.toLongLong() : 0;

    qDebug() << "File size captured: " << fs;
    

    am getting filesizeVar Qvariant(Invalid)


  • Moderators

    Ok. Any reason to use the QEventLoop ?
    Also please use the code tags "@@" to post a code here.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.