[Qt-interest] QNetworkAccessManager file upload and uri encode

Wagner Ferreira Soares wagner.fsoares at gmail.com
Wed May 20 20:51:40 CEST 2009


I've managed to create an application that can communicate with a webhost.
I can do a post within my application, send some text to the server, receive
the result information and print it with a messagebox.
The problem is, some characters cause problems when I'm sending the text
(i.e. &, ', ", \ ), in javascript I can use "encodeURIComponent" so what
could I use in Qt4?

And what about file uploading? how could I send a file with
QNetworkAccessManager? The browser is responsible for sending binary "text"
to the server when I choose a file and click on submit, how can I do it in
Qt4?

my actual send code:

QByteArray data;
data.append("r=test");
QUrl url("http://localhost/test.php");
QNetworkRequest qnr(url);
QNetworkAccesManager *qnam = new QNetworkAccesManager(this); /* this line
isn't actually here, I placed it here just to show what qnam is! */
qnam->post(qnr, data);

thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090520/9bbd52d1/attachment.html 


More information about the Qt-interest-old mailing list