Results 1 to 2 of 2

Thread: Upload file via HTTP - callback/signal for feeding data from buffer (not via QFile)

  1. #1
    Join Date
    Mar 2016
    Posts
    6
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Upload file via HTTP - callback/signal for feeding data from buffer (not via QFile)

    Hi,
    I'm porting a GUI Windows application to Linux, and am using Qt, mainly for it's GUI framework, but also for all the good Qt has to offer.

    The original code uses libcurl for HTP communication, uploading files. The curl_multi_ asynchronous API is used, for non-blocking behavior.
    Files, which are dynamically created, are being uploaded. a WRITE callback is being set to cURL, and is called so the user will 'feed' cURL with more data to upload.

    What I know and have seen in Qt, is that a QFile is being passes, and everything is being done 'behind the scene'. signals of progress and finish are emitted, as apposed to a GET request, where readyRead() signal is emitted.

    I thought of creating a temporary file, just before using the standard Qt method, and passing this file to the NAM, but am hoping for a more elegant solution.
    Is there a way to use Qt the way cURL works?
    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Upload file via HTTP - callback/signal for feeding data from buffer (not via QFil

    QNetworkAccessManager:ut() can also take a QByteArray - no need to create a file and open it with QFile... http://doc.qt.io/qt-5/qnetworkaccessmanager.html#put-1

Similar Threads

  1. Upload file to HTTP server
    By produktdotestow in forum Qt Programming
    Replies: 5
    Last Post: 30th July 2011, 15:18
  2. Problem in Http file upload
    By dipeshtech in forum Qt Programming
    Replies: 1
    Last Post: 28th April 2011, 09:44
  3. Replies: 13
    Last Post: 10th March 2011, 08:35
  4. How to upload file to HTTP server (POST Method)
    By Alex Snet in forum Qt Programming
    Replies: 8
    Last Post: 24th January 2011, 23:49
  5. QFile - file read parts of the buffer
    By eugen_Qt in forum Qt Programming
    Replies: 4
    Last Post: 10th November 2009, 15:52

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.