<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QHttpMultiPart file upload]]></title><description><![CDATA[<p dir="auto">Hi, I am trying to upload file from the Qt app to the server, from QHttpMultiPart doc copied this code</p>
<pre><code>void FileUploader::postProcesser3()
{
    qDebug() &lt;&lt; "uploading 3";

    QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);

    QHttpPart textPart;
    textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"text\""));
    textPart.setBody("my text");

    QHttpPart imagePart;
    imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg"));
    imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"image\"; filename=\"1.jpg\""));
    QFile *file = new QFile("1.jpg");
    qDebug() &lt;&lt; file-&gt;open(QIODevice::ReadOnly);
    imagePart.setBodyDevice(file);
    file-&gt;setParent(multiPart); // we cannot delete the file now, so delete it with the multiPart

    multiPart-&gt;append(textPart);
    multiPart-&gt;append(imagePart);

    QUrl url("http://localhost/medialinks/ci/index.php/data/fileupload_test/");
    QNetworkRequest request(url);

    //QNetworkAccessManager manager;
    QNetworkAccessManager * manager = new QNetworkAccessManager();
    QNetworkReply *reply = manager-&gt;post(request, multiPart);
    multiPart-&gt;setParent(reply); // delete the multiPart with the reply

    // here connect signals etc.
    connect(manager, SIGNAL(finished(QNetworkReply*)), SLOT(replyFinished(QNetworkReply*)));
    connect(reply, SIGNAL(uploadProgress(qint64,qint64)), this, SLOT(SlotSetProgressLevel(qint64, qint64)));

    connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
             this, SLOT  (uploadError(QNetworkReply::NetworkError)));
}

void FileUploader::uploadError(QNetworkReply::NetworkError)
{
    qDebug() &lt;&lt; "error";
}

void FileUploader::SlotSetProgressLevel(qint64, qint64)
{
    qDebug() &lt;&lt; "uploading progress";
}

void FileUploader::replyFinished(QNetworkReply* reply)
{
    qDebug() &lt;&lt; "upload finished";

    qDebug() &lt;&lt; reply-&gt;readAll();
}
</code></pre>
<p dir="auto">but I don't get any error or finished signal but the file also not uploaded. This is the debugging result</p>
<pre><code>uploading 3
true
qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv2_server_method
</code></pre>
<p dir="auto">this is server script it's in codeigniter(php)</p>
<pre><code>public function fileupload_test()
	{
		$this-&gt;load-&gt;library('upload');
		$config['upload_path'] = $this-&gt;config-&gt;item('server_path').'data/event/'.'w_full';
		$config['file_name'] = "f.jpg";

		$config['allowed_types'] = '*';
		$this-&gt;upload-&gt;initialize($config);
		if(!$this-&gt;upload-&gt;do_upload('image')){

			//upload error
			echo "file uploading failed";
			//var_dump($this-&gt;upload-&gt;display_errors());
			
			// remove created posts
			//$this-&gt;teamdb-&gt;remove_unsuccesfull_post($ids);
			exit;
		} else {

			// success, add data to database
			echo 'success';
		}
	}
</code></pre>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.qt.io/topic/80040/qhttpmultipart-file-upload</link><generator>RSS for Node</generator><lastBuildDate>Tue, 01 Sep 2026 22:17:21 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/80040.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Jun 2017 10:34:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QHttpMultiPart file upload on Wed, 07 Jun 2017 13:00:21 GMT]]></title><description><![CDATA[<p dir="auto">sorry guys my mistake I initialize the class like</p>
<pre><code>Updater update;
</code></pre>
<p dir="auto">so when the function finish executing it also delete my methord</p>
<p dir="auto">now I am initialize</p>
<pre><code>Updater *updatedata = new Updater;
</code></pre>
<p dir="auto">it works, sorry for wasting time</p>
]]></description><link>https://forum.qt.io/post/397950</link><guid isPermaLink="true">https://forum.qt.io/post/397950</guid><dc:creator><![CDATA[4j1th]]></dc:creator><pubDate>Wed, 07 Jun 2017 13:00:21 GMT</pubDate></item><item><title><![CDATA[Reply to QHttpMultiPart file upload on Wed, 07 Jun 2017 12:33:14 GMT]]></title><description><![CDATA[<p dir="auto">my class deceleration is</p>
<pre><code>#ifndef FILEUPLOADER_H
#define FILEUPLOADER_H
#include &lt;QThread&gt;
#include &lt;QNetworkReply&gt;
#include &lt;QList&gt;


class FileUploader : public QThread
{
    Q_OBJECT
public:
    FileUploader();

    void run();

private:

    void postProcesser();
    void postProcesser2();
    void postProcesser3();

private slots:

    void replyFinished(QNetworkReply *reply);

    void SlotSetProgressLevel(qint64, qint64);

    void uploadError(QNetworkReply::NetworkError);

    void uploadError2(QNetworkReply *reply, QList&lt;QSslError&gt; list);
};

#endif // FILEUPLOADER_H

</code></pre>
]]></description><link>https://forum.qt.io/post/397939</link><guid isPermaLink="true">https://forum.qt.io/post/397939</guid><dc:creator><![CDATA[4j1th]]></dc:creator><pubDate>Wed, 07 Jun 2017 12:33:14 GMT</pubDate></item><item><title><![CDATA[Reply to QHttpMultiPart file upload on Wed, 07 Jun 2017 12:23:26 GMT]]></title><description><![CDATA[<p dir="auto">I don't understand what going on with this code but if I move this code to mainwindow class it's work perfectly with the above mentioned error</p>
<pre><code>qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv2_server_method
</code></pre>
]]></description><link>https://forum.qt.io/post/397934</link><guid isPermaLink="true">https://forum.qt.io/post/397934</guid><dc:creator><![CDATA[4j1th]]></dc:creator><pubDate>Wed, 07 Jun 2017 12:23:26 GMT</pubDate></item><item><title><![CDATA[Reply to QHttpMultiPart file upload on Wed, 07 Jun 2017 11:20:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vronin">@<bdi>VRonin</bdi></a>, I tried that</p>
<pre><code>connect(manager, SIGNAL(sslErrors(QNetworkReply*,QList&lt;QSslError&gt;)),
             this, SLOT  (uploadError2(QNetworkReply *, QList&lt;QSslError&gt;)));


void FileUploader::uploadError2(QNetworkReply* reply,QList&lt;QSslError&gt; list)
{
    qDebug() &lt;&lt; list &lt;&lt; reply-&gt;readAll();
}
</code></pre>
<p dir="auto">debug result</p>
<pre><code>uploading 3
true
qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv2_server_method
</code></pre>
<p dir="auto">In my previous project i got this ssl socket error but it work fine, one developer advise me to ignore it, it's some error in libssl <a href="https://forum.qt.io/topic/16139/solved-qsslsocket-error-sslv2/3">https://forum.qt.io/topic/16139/solved-qsslsocket-error-sslv2/3</a></p>
]]></description><link>https://forum.qt.io/post/397908</link><guid isPermaLink="true">https://forum.qt.io/post/397908</guid><dc:creator><![CDATA[4j1th]]></dc:creator><pubDate>Wed, 07 Jun 2017 11:20:45 GMT</pubDate></item><item><title><![CDATA[Reply to QHttpMultiPart file upload on Wed, 07 Jun 2017 10:47:23 GMT]]></title><description><![CDATA[<p dir="auto">If you connect to <code>QNetworkAccessManager::sslErrors(QNetworkReply *, const QList&lt;QSslError&gt; &amp;)</code>  signal it will probably be more clear what's going on. My guess is that your program can't find OpenSSL. Did you try adding the path to the OpenSSL binaries to the Project-&gt;Run Environment in Qt Creator (assuming you use that)?</p>
]]></description><link>https://forum.qt.io/post/397891</link><guid isPermaLink="true">https://forum.qt.io/post/397891</guid><dc:creator><![CDATA[VRonin]]></dc:creator><pubDate>Wed, 07 Jun 2017 10:47:23 GMT</pubDate></item></channel></rss>