×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    102

    Download File Using QNetworkAccessManager

    Hi ALl,
    i'd like to insert in my application the possibility to download a file from server. I've read that i can make this using class QNetwrkAccessManager and QnetworkReply, but i don't understand how can i retrive file downloaded.
    Could you help me?
    Thanks.

  2. #2
    Registered User
    Join Date
    Mar 2010
    Posts
    53

    Re: Download File Using QNetworkAccessManager

    Hi earendil !
    You can try this:

    void Download:downloadFile(const QString &url, const QString &aPathInClient)
    {
    QNetworkAccessManager m_NetworkMngr = new QNetworkAccessManager(this);
    QNetworkReply *reply= m_NetworkMngr->get(QNetworkRequest(url));
    QEventLoop loop;
    connect(reply, SIGNAL(finished()),&loop, SLOT(quit()));
    loop.exec();
    QUrl aUrl(url);
    QFileInfo fileInfo=aUrl.path();

    QFile file(aPathInClient+"\\"+fileInfo.fileName());
    file.open(QIODevice::WriteOnly);
    file.write(reply->readAll());

    delete reply;
    }

  3. #3
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    102

    Re: Download File Using QNetworkAccessManager

    I think that this i could use if file is small but file that i must download is more that 100MB.
    Do you know if i can write file by steps?

  4. #4
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Dublin
    Posts
    240

    Re: Download File Using QNetworkAccessManager

    http://wiki.forum.nokia.com/index.ph..._request_in_Qt
    http://www.forum.nokia.com/search/?k...s=cw&ea=1&eo=1
    How about listening through 'void QNetworkReply::downloadProgress ( qint64 bytesReceived, qint64 bytesTotal )'
    Last edited by datha_k; 2010-05-19 at 12:03.

  5. #5
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    102

    Re: Download File Using QNetworkAccessManager

    I solved my problem using signal readyRead() of QNetworkReply Obj.
    Thanks to All.

Similar Threads

  1. [Announce] pygame for S60 for PyS60 1.9.x
    By GameDude in forum Symbian
    Replies: 57
    Last Post: 2011-02-21, 23:18
  2. Replies: 7
    Last Post: 2007-10-02, 14:59
  3. Series 40 - http download of parts of file not possible ?
    By sankotm in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2005-07-27, 12:35
  4. File too large to download using WAP
    By nlecomte in forum Symbian
    Replies: 0
    Last Post: 2003-04-29, 07:33
  5. nokia 7210 modem via IR doesn't work !
    By oussamaaiadi in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-03-06, 10:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •