View Full Version : How to upload image file in FTP server

31st July 2014, 06:29
Hi ,
I want to upload image file in ftp server but i'm not able to upload file in it.Any one give a solution and scratch code for uploading image file ftp server.

Below is the scratch code which i have developed, this code is executed without an error but "bg.png" file is not uploaded in the server.

QFTP *ftp=new QFtp;
ftp->cd("directory name");
// ftp->mkdir("test");
// ftp->cd("test");
ftp->put(new QFile("bg.png"),"bg.png");

Thanks in advance

31st July 2014, 09:03
Are you aware of the fact that QFtp operations are asynchronous ? Have you checked the "QFtp::error()" ?
Btw. QFile pointer which you passed to "put" will leak, you should delete it after "put" command is finished. I also think you should open the file for reading before passing it to "put" method.