void MainWindow postrequest QStringList postlist for int postlist appe

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
void MainWindow::postrequest()
{
QStringList postlist;
for(int i=0; i<3; i++)
{
postlist.append("imgfile"+QString::number(i+1)+"=" + QString::number(i));
}
QString post = postlist.join("&");
QHttpRequestHeader header("POST", "/index.php", 1, 1);
header.addValue("Content-Type","application/x-www-form-urlencoded");
header.addValue("Cache-Control", "no-cache");
http->setHost("localhost");
header.addValue("Host", "localhost");
header.addValue("Accept","*/*");
QByteArray postdata;
postdata.append(post);
http->request(header, postdata);
}