Environment:
Ftp: Centos6.5 + vsftp
Client: Windows7 64
Error: "Error while downloading Could not get file size."
Error code: ContentNotFoundError 203
When i try to get an file on FTP, got that error info. But when i used Windows7 + IIS as Ftp server . The file was downloaded successful,.
Here is the Qt code:
QUrl ftpInfo;
ftpInfo.setScheme("ftp");
ftpInfo.setHost("192.168.1.170");
ftpInfo.setPath("/test.txt");
ftpInfo.setPort(21);
ftpInfo.setPassword("123");
ftpInfo.setUserName("123");
QNetworkRequest ftpRequest;
ftpRequest.setUrl(ftpInfo);
ftpReply = ftp->get(ftpRequest);
connect(ftp, SIGNAL(finished(QNetworkReply*)), this, SLOT(readReply(QNetworkReply*)));
connect(ftpReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slotError(QNetworkReply::NetworkError)));
Here is the solution:
ftpInfo.setPath("/test.txt"); //For Linux Ftp not not work, But IIS Ftp no problem.
ftpInfo.setPath("test.txt"); //Both work fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.