How to upload file to FTP server in Qt?

Searched through a bunch of addicts, but never found:
How to upload a local file to a remote FTP server?

I don't have here such piece:

// Sending file via FTP<br>;<br>
<br / >
QFtp *ftp = new QFtp;<br>
 connect(ftp, SIGNAL(done(bool)), this, SLOT(close()));<br>
<br / >
ftp->connectToHost("", 21);<br>
 ftp->login("login", "password");<br>
<br / >
//??? Here is supposed to be ftp->put()<br>
<br / >

The actual report is QFile, which need to upload to the server.

As pravlno to write?
October 8th 19 at 02:03
2 answers
October 8th 19 at 02:05
put expects QIODeviceand QFile are inherited from it, so:

ftp->put(&report, report.fileName());

From Qt documentation is very good, don't be afraid to use it.
Another point: put does not block the execution and the file will be closed as soon as transfer starts. - Enos_Bedn commented on October 8th 19 at 02:08
Thank you so much, but the addition is not very understand — and how to prevent this behavior? - ephraim_Rob commented on October 8th 19 at 02:11
missed a few: - Enos_Bedn commented on October 8th 19 at 02:14
October 8th 19 at 02:07
The function returns a unique identifier which is passed by commandStarted() and commandFinished().

Remember a few file-ID, to pick up the signal commandFinished, close it and release resources.

Find more questions by tags QtFTP