PDA

View Full Version : Sending MIME over HTTP



Septi
29th November 2010, 07:24
So, I need to do just that. I see there's QMimeData class out there, I can create mime data with it, but I see no way to extract it as plain data (as in QByteArray), to send it in HTTP POST request. Please point me in the right direction :)

bothorsen
29th November 2010, 13:12
You can't do that directly. But if you call QByteArray::toBase64() you get a string of ascii characters that can be sent.

Septi
2nd December 2010, 08:38
I see... But AFAIK, the base64-coded data isn't all I need. Do you know any library I could use to write MIME?

wysota
2nd December 2010, 09:14
You don't need any library. mime-type only informs the other end of communication what kind of data is being sent. Then you just send the actual data in the format you declared with the mime-type. "MIME" is not any kind of special format on its own. If you have a png image then its mime-type is image/png, if you have an mp3 file then its mime-type is audio/mp3, if you have custom binary data then the mime-type is application/octet-stream, simple text is text/plain, etc. You declare the type of the data and not convert the data to the mime type.