1,317
社区成员
发帖
与我相关
我的任务
分享
QFile txt1(m_upgrade_file_name);
txt1.open(QIODevice::ReadOnly);
QByteArray by_txt = txt1.readAll();
qDebug() << ty_txt << endl;
txt1.close();
QUrl url;
url.setScheme("ftp");
url.setHost(ui->lineEdit_IP_Input->text());//地址
url.setPath(name);//文件名
url.setPort(ui->lineEdit_Ftp_Port_Input->text().toInt());//端口
url.setPassword(ui->lineEdit_Pwd_Input->text()); //设置ftp用户密码
url.setUserName(ui->lineEdit_User_Input->text());//设置ftp用户名
QNetworkRequest request;//该QNetworkReply类包含的数据和标题,对QNetworkAccessManager发送请求
qDebug() << url.toString() << endl;
request.setUrl(url); //这只request的请求
QNetworkAccessManager *manager = new QNetworkAccessManager;//QNetworkAccessManager 允许发送网络请求和接收回复
QNetworkReply *reply = manager->put(request, by_txt);
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));