Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.12
-
None
-
Qt 5.9, 5.12
Windows 7, 10
VC++ 2015, 2017
Description
Windows based application is sending files to a PHP page on a server. Using POST through Google Chrome, speed is about 480Mbps. Using scp and FTP to transfer files between test computer and server is about the same speed of 480Mbps. Using the code below, the transfer speed is about 10Mbps. Application has been tested on multiple computers connecting to two different servers. This is an identical problem to bug #22606.
/* loop through the list of files */ ui->progUpload->setRange(0,100); for (int i=0;i<list.size();i++) { qDebug("UploadFileList [%d] [%s]", i, list[i].toStdString().c_str()); QFile *file = new QFile(list[i]); QHttpPart filePart; filePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"files[]\"; filename=\""+ file->fileName() + "\"")); file->open(QIODevice::ReadOnly); filePart.setBodyDevice(file); file->setParent(multiPart); // we cannot delete the file now, so delete it with the multiPart multiPart->append(filePart); } /* check if there was a previous upload still going on */ while (isUploading) { ui->lblStatus->setText("Waiting for previous upload to complete..."); QTest::qWait(1000); } /* do the POST and setup the event handlers for it */ QNetworkReply* reply = networkManager->post(request, multiPart); multiPart->setParent(reply); // delete the multiPart with the reply numNetConn++; isUploading = true; connect(reply, SIGNAL(finished()), this, SLOT(onGetReplyUpload())); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onNetworkError(QNetworkReply::NetworkError))); connect(reply, SIGNAL(uploadProgress(qint64, qint64)), SLOT(progressChanged(qint64, qint64))); WriteLog(QString("Finished queueing %1 files for upload...").arg(list.size()));