Upload file to server via https
-
Hello,
i'm new in QT and i do not know how to send file to server. I have url like:
"https://www.example.com/?import=data=&DATA&",
where &DATA& is that file.i need something like:
request("https://www.example.com/?import=data=&DATA&"); respond = respond(); qDebug << respond;
Is is possible?
-
Hello,
i'm new in QT and i do not know how to send file to server. I have url like:
"https://www.example.com/?import=data=&DATA&",
where &DATA& is that file.i need something like:
request("https://www.example.com/?import=data=&DATA&"); respond = respond(); qDebug << respond;
Is is possible?
@xbasista
From that URL I don't think it takes a file to upload. Rather I suspect you have to supply the data/content of the file where shown on the URL?You can use QNetworkReply *QNetworkAccessManager::get(const QNetworkRequest &request) to make the URL request you show.
-
Hello,
i'm new in QT and i do not know how to send file to server. I have url like:
"https://www.example.com/?import=data=&DATA&",
where &DATA& is that file.i need something like:
request("https://www.example.com/?import=data=&DATA&"); respond = respond(); qDebug << respond;
Is is possible?
@xbasista
From that URL I don't think it takes a file to upload. Rather I suspect you have to supply the data/content of the file where shown on the URL?You can use QNetworkReply *QNetworkAccessManager::get(const QNetworkRequest &request) to make the URL request you show.
-
Hello,
i'm new in QT and i do not know how to send file to server. I have url like:
"https://www.example.com/?import=data=&DATA&",
where &DATA& is that file.i need something like:
request("https://www.example.com/?import=data=&DATA&"); respond = respond(); qDebug << respond;
Is is possible?
-
Hi and welcome to devnet,
Beside the good points of my fellow, depending on your OS ensure that you have OpenSSL available as well.
-
Thanks,
@JonB you were right. I made simple http request as you wrote. It is working perfectly but when I put that application on another pc I get empty response (response = ""). It looks like application do not comunication to server. I tried add exception to windows firewall, turn off ativirus but it still not working.
Does anyone know where the problem might be?
-
Thanks,
@JonB you were right. I made simple http request as you wrote. It is working perfectly but when I put that application on another pc I get empty response (response = ""). It looks like application do not comunication to server. I tried add exception to windows firewall, turn off ativirus but it still not working.
Does anyone know where the problem might be?
@xbasista said in Upload file to server via https:
Does anyone know where the problem might be?
You should add error handling to your code to see what happens.
https://doc.qt.io/qt-5/qnetworkreply.html#errorOccurred -
Thanks,
@JonB you were right. I made simple http request as you wrote. It is working perfectly but when I put that application on another pc I get empty response (response = ""). It looks like application do not comunication to server. I tried add exception to windows firewall, turn off ativirus but it still not working.
Does anyone know where the problem might be?
-
-
@jsulm
I added to my code and i found out that on another pc is not openssl support [ QSslSocket::supportsSsl() ].
I read that https://stackoverflow.com/questions/20351155/how-can-i-enable-ssl-in-qt-windows-application and i think i need libeay32.dll and ssleay32.dll libs. The problem is i do not know where can i found that files? They shloud be in openSSL folder/bin but i don't have that folder.Output on build pc:
SslSupport: true SslLibraryBuildVersion: "OpenSSL 1.1.1g 21 Apr 2020" SslLibraryRuntimeVersion: "OpenSSL 1.1.1k 25 Mar 2021"
Output on another pc:
SslSupport: SslLibraryBuildVersion: "OpenSSL 1.1.1g 21 Apr 2020" SslLibraryRuntimeVersion:
-
I found out that:
"
For ssl 1.0.x (qt<5.12.4) you are likely missing libeay32.dll and ssleay32.dll.For ssl 1.1.x (qt>=5.12.4) binary compatibility broke (qt 5.12.4 released), so you might need libssl-1_1.dll and libcrypto-1_1.dll, and its dependencies capi.dll and dasync.dll.
"So i import libssl-1_1-x64.dll and libcrypto-1_1-x64.dll from my openssl and everything working.
Thanks