Hello. I have got a problem, I'm sitting on it all day long, and have no idea what is wrong.
Qt Code:
manager = new QNetworkAccessManager;
param.addQueryItem("file","sometext");
postData.append(param.encodedQuery());
QNetworkRequest request;
request.
setUrl(QUrl("http://localhost/file.php"));
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/octet-stream");
manager->post(request,postData);
connect(manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(downloadFinished(QNetworkReply*)));
manager = new QNetworkAccessManager;
QUrl param;
param.addQueryItem("file","sometext");
QByteArray postData;
postData.append(param.encodedQuery());
QNetworkRequest request;
request.setUrl(QUrl("http://localhost/file.php"));
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/octet-stream");
manager->post(request,postData);
connect(manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(downloadFinished(QNetworkReply*)));
To copy to clipboard, switch view to plain text mode
And in downloadFinished: reply->readAll() (with checking for errors etc). Server is giving me response, but without variable from $_POST ($_POST array is empty). My php script file.php:
if( $_POST['file'] )
{
echo "Filename is ". $_POST['file']. "<br />";
}
if( $_POST['file'] )
{
echo "Filename is ". $_POST['file']. "<br />";
}
To copy to clipboard, switch view to plain text mode
Anyone know what can be wrong? Please help
Bookmarks