View Full Version : How to send ByteArray in QHttpPart

5th June 2013, 08:52

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

5th June 2013, 21:14
If you already have the data in a QByteArray then use that.

6th June 2013, 11:01
Just in case: QBuffer is a QIODevice that works on a QByteArray