Results 1 to 3 of 3

Thread: How to send ByteArray in QHttpPart

  1. #1
    Join Date
    Feb 2013
    Location
    India
    Posts
    153
    Thanks
    27
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Exclamation How to send ByteArray in QHttpPart

    Hello,

    I just want to know the main difference between the QHttpPart methods "setBody()" and "setDeviceBody()".

    as i have read about both two is:
    setBody takes QByteArray as an argument. (this method will be used unless the device is set, or small amount of data)
    setDeviceBody takes QIODevice as an argument. (It uses for large amount of data)

    Now my problem is i want to send Byte array of large image file.
    In this case setBody fails but setDevice body only takes argument as QIODevice.

    I dont want to save my bytearray data into a digital file.
    Anyone have idea to send large byteArray through QHttpPart

  2. #2
    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 send ByteArray in QHttpPart

    If you already have the data in a QByteArray then use that.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to send ByteArray in QHttpPart

    Just in case: QBuffer is a QIODevice that works on a QByteArray

    Cheers,
    _

  4. The following user says thank you to anda_skoa for this useful post:

    karankumar1609 (7th June 2013)

Similar Threads

  1. How to write ByteArray into a text file?
    By babygal in forum Newbie
    Replies: 4
    Last Post: 11th October 2010, 05:19
  2. conversion from bytearray to int produce zero
    By daemonna in forum Qt Programming
    Replies: 3
    Last Post: 12th August 2010, 00:52
  3. Read ByteArray
    By kewlcode in forum Qt Programming
    Replies: 19
    Last Post: 5th April 2009, 11:41
  4. singal send twice?
    By masoroso in forum Qt Programming
    Replies: 1
    Last Post: 12th April 2007, 14:47
  5. how to send file with qt c++?
    By wei243 in forum Qt Programming
    Replies: 5
    Last Post: 3rd March 2007, 10:32

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.