我一直在阅读有关QNetworkAccessManager的信息,但无法弄清楚如何正确设置ssl连接并发送文件。我没有任何联网方面的经验,所以也许我缺少明显的东西吗?
到目前为止,这是我的尝试(我消除了一些混乱):
QUrl url("https://.........");
url.setUserName(username);
url.setPassword(password);
QNetworkRequest request(url);
QSslConfiguration sslConf = QSslConfiguration::defaultConfiguration();
sslConf.setPeerVerifyMode(QSslSocket::VerifyNone);
QSslConfiguration::setDefaultConfiguration(sslConf);
request.setSslConfiguration(sslConf);
QFile *file = new QFile(filepath);
file->open(QIODevice::ReadOnly);
QByteArray fileContent(file->readAll());
QNetworkReply* reply = manager->post(request, fileContent);