Ftp user details fetching
-
I am implementing ftp file transfer in my app. In my app i have to add functionality to get user details and store them in a file I am able to get file uploaded to filezilla but not able to get user details like username password.
void example::replyFinished(QNetworkReply *rep1){
QNetworkReply::NetworkError error = rep1->error();
if (error == QNetworkReply::NoError) {QByteArray bts = rep1->readAll();
}
In this slot readAll is returning empty. So is their any method of any way of getting user details in app from server I searched on net but not get any solution yet.
-
Hi and welcome to devnet,
What do you mean by the user details ? Where from ?
-
thanks for replying
From user details I mean username ,password etc
and from ftp(file transfer protocol) from serverIf i am making connection using QNetworkAccessManager and bye providing http://(domain) then this code
void example::replyFinished(QNetworkReply *rep1){
QNetworkReply::NetworkError error = rep1->error();
if (error == QNetworkReply::NoError) {
QByteArray bts = rep1->readAll(); }returning these userdetails in variable "bts" .
but if i use ftp:// (domain) then this code returning nothing after successfully connecting to server currently in case of ftp i am using filezilla as server
-
It's still not clear. Do you want to ask the user of your program to provide the username and password ? Or should it be downloaded from the ftp ?
-
it should be downloaded from ftp
in the code slot void example::replyFinished(QNetworkReply rep1) is called when connection emits finished(QNetworkReply) signal then if must return these details in variable bts is it possible in case of ftp.
-
So you have a plain text file on your ftp containing username/password combinations that you want to download ?
-
Are you sure that you provide the correct file name when you use ftp protocol?
When you use http protocol without specifying a file you actually download the default file - actual file name depends on web-server's settings but usually is default.htm or index.htm or *.html
That is not the case with ftp though - there is no default file to download
e.g.
http://www.example.com/
could actually serve you s.th. like
http://www.example.com/index.html
or
http://www.example.com/default.html
while
ftp://ftp.example.com/
will serve you nothing - you'll only connect to that server and it will wait for your commands (LIST, GET, PUT etc.)
so you'll have to specify actual file name
ftp://ftp.example.com/index.html
or (as usually is the case with web server residing on different path)
it is more likely to be
ftp://ftp.example.com/www/inetpub/thatcorp/that_website/index.htm -
I got it solved
thanks guys