Answer the question
In order to leave comments, you need to log in
How to upload a file to an FTP server in Qt?
I looked through a lot of mana, but I did not find the right one:
How to upload a local file to a remote FTP server?
So far I have this piece:
// Отправка файла по FTP<br/>
report.open(QIODevice::ReadOnly);<br/>
<br/>
QFtp *ftp = new QFtp;<br/>
connect(ftp, SIGNAL(done(bool)), this, SLOT(close()));<br/>
<br/>
ftp->connectToHost("10.1.2.2", 21);<br/>
ftp->login("login", "password");<br/>
ftp->cd("REPORTS");<br/>
<br/>
//??? Вот тут по идее должен быть ftp->put()<br/>
<br/>
report.close();
Answer the question
In order to leave comments, you need to log in
put expects QIODevice , and QFile inherits from it, which means:
ftp->put(&report, report.fileName());
Qt has very good documentation, don't be afraid to use it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question