Page 2 of 2 FirstFirst 12
Results 21 to 28 of 28

Thread: How to download a file using HTTP with URL in QT?

  1. #21
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to download a file using HTTP with URL in QT?

    Could to please help me this code to work on using QNetworkAccessManager??? Kindly help me...

    Could you please help me in downloading this .... using QNetWorkAccessManager.. kindly help me

  2. #22
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to download a file using HTTP with URL in QT?

    It looks like you started by copy-n-paste from one of the examples but, when it didn't Just Work, you thrashed about looking for another cut-n-paste code snippet rather than trying to understand why it didn't work.

    Stop hacking at your code. Open Qt Assistant, navigate to the "Qt Reference Documentation", then "Tutorials and Examples", then "Network" examples. There are three examples you should study (in order):
    • HTTP
    • Download
    • Download Manager
    They all compile, work, and download file(s) with varying degrees of complexity. When you find something in the examples that you do not understand then ask.

    Also, read back through this thread, especially the post by Berryblue031.

    You wondered what RESPONSE_ERROR the other constants were: user-defined symbolic names for HTTP status codes

  3. #23
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to download a file using HTTP with URL in QT?

    Yes, now the file is downloaded. But Am not getting the file with actual size..

  4. #24
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to download a file using HTTP with URL in QT?

    Quote Originally Posted by Gokulnathvc View Post
    Yes, now the file is downloaded. But Am not getting the file with actual size..
    Sorry, my crystal ball is broken. Care to give us a bit more information?

  5. #25
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to download a file using HTTP with URL in QT?

    Quote Originally Posted by squidge View Post
    Sorry, my crystal ball is broken.
    You should really get a spare one :P
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #26
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to download a file using HTTP with URL in QT?

    Do you know how much crystal balls are now? I can't really afford a spare one.

  7. #27
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to download a file using HTTP with URL in QT?

    Crystal balls are issued free to Masters of Zen but mere Experts have to provide their own - get used to the idea
    My crystal ball predicts that this thread is not dead yet.

    Gokulnathvc: Here is how to ask your question:

    I have am trying to download a {binary/text} {PDF/database/Transylvanian folk remedy} file using HTTP, QNetworkAccessManager and code based on the XYZ example from Assistant. My actual code is:
    Qt Code:
    1. // my actual code, inside [code ]...[/code ] tags, and distilled down to a small
    2. // compilable example that demonstrates the problem
    To copy to clipboard, switch view to plain text mode 
    The request is being processed and there I am seeing a signal that the request is done. However, when I save the data my file is not empty but it is also not complete. As you can see every call that generates a true/false status or error code return value is being checked and there are no errors being reported. I have tried other files and {insert what happened differently}. I've also tried other web sites and {insert more evidence you have tried to solve this yourself}.

    If I use the example code without modification then the file is downloaded OK. The differences between my code and the example are {insert description here} or:
    Qt Code:
    1. // more code differences inside [code ]...[/code ] tags
    To copy to clipboard, switch view to plain text mode 
    I have tried {more stuff} with {more results} but I really cannot see what I am doing wrong.

    Could someone please provide advice so that I can solve my problem?

  8. #28
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to download a file using HTTP with URL in QT?

    Thanks for you kind co-operation. I have fixed it. I have added finished() function under this. Now its working fine.. Thank you

Similar Threads

  1. HTTP pause download in QTCreator
    By nhs_0702 in forum Qt Programming
    Replies: 12
    Last Post: 29th November 2010, 14:24
  2. Download file to QString
    By Chiggins in forum Qt Programming
    Replies: 2
    Last Post: 25th June 2010, 19:16
  3. I want to download a piece of file?
    By mismael85 in forum General Programming
    Replies: 1
    Last Post: 27th February 2010, 15:35
  4. Download File
    By BalaQT in forum Qt Programming
    Replies: 2
    Last Post: 13th February 2010, 09:53
  5. Download via HTTP in several threads?
    By bjilly in forum Qt Programming
    Replies: 6
    Last Post: 30th November 2009, 14:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.