PDA

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



mania
31st July 2014, 05: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->connectToHost("ipaddress");
ftp->login("username","password");
ftp->list();
ftp->cd("directory name");
// ftp->mkdir("test");
// ftp->cd("test");
ftp->put(new QFile("bg.png"),"bg.png");
ftp->list();


Thanks in advance

stampede
31st July 2014, 08: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.