I am trying to upload an executable file to the server using this code:
QFileDialog dialog(this);
dialog.setDirectory(QDir::home());
QStringList fileNames = QFileDialog::getOpenFileNames(this,tr("Open File"));
if(fileNames.count() == 1)
{
QFileInfo fi(fileNames.at(0));
}
the path of file is the content of variable fileNames and i extract the filename from the path with fileNames.at(0). How I can upload the file.. I am trying with this code but file is not uploaded:
QByteArray postData;
postData.append(path);
QString url ="http://localhost/upload.php";
//type header
req.setHeader(QNetworkRequest::ContentTypeHeader,"multipart/form-data");
req.setUrl(url);
manager=new QNetworkAccessManager(this);
reply=manager->post(req,postData);
... Any help would be appreciated..