void MainWindow::send_img() { http->setHost("test6.ru"); QFile file(ui->lineEdit_3->text()); file.open(QIODevice::ReadOnly); QDataStream read(&file); int lBytes = 0; char * ch; ch = (char*)malloc(sizeof(char) * 1024); ch[1023] = '\0'; while(!read.atEnd()){ int l = read.readRawData(ch, sizeof(char)*1023); QByteArray ba(ch, sizeof(char)*l); http->post("/upload.php",ba); } free((void*)ch); send_req("//upload.php", "FLAG=end"); }
|