Hi i all
i am a new user of QT i have a problem.
I connect to a ftp server using QFTP all work i need to put a file on this server.
ftp is a global variable when a call myroutine is loggedin on server.
i have connect this Signal to my slot:
connect(ftp,SIGNAL(done(bool)),this,SLOT(chkstat(bool)));
connect(ftp,SIGNAL(commandFinished(int,bool)),this,SLOT(CmdFinishSlot()));
connect(ftp,SIGNAL(commandStarted(int)),this,SLOT(CmdStartSlot()));
connect(ftp,SIGNAL(dataTransferProgress(qint64,qint64)),this,SLOT(ftpProgress(qint64,qint64)));
connect(ftp,SIGNAL(done(bool)),this,SLOT(chkstat(bool)));
connect(ftp,SIGNAL(commandFinished(int,bool)),this,SLOT(CmdFinishSlot()));
connect(ftp,SIGNAL(commandStarted(int)),this,SLOT(CmdStartSlot()));
connect(ftp,SIGNAL(dataTransferProgress(qint64,qint64)),this,SLOT(ftpProgress(qint64,qint64)));
To copy to clipboard, switch view to plain text mode
When i try to execute the routine to put a file
{
ftp->cd(RemoteDir);
foreach (FileList, LDirToPut.entryInfoList())
{
qDebug()<< FileList.fileName();
if(FileList.isFile())
{
CmdFinish=false;
buffer=file->readAll();
buffer=buffer.toBase64();
ftp
->put
(buffer,FileList.
fileName(),
QFtp::Binary);
while(CmdFinish){};
file->close();
};
};
}
void myroutine (QDir LDirToPut,QString RemoteDir)
{
QFileInfo FileList;
QByteArray buffer;
ftp->cd(RemoteDir);
foreach (FileList, LDirToPut.entryInfoList())
{
qDebug()<< FileList.fileName();
if(FileList.isFile())
{
CmdFinish=false;
QFile *file = new QFile(FileList.fileName());
file->open(QIODevice::ReadOnly);
buffer=file->readAll();
buffer=buffer.toBase64();
ftp->put(buffer,FileList.fileName(),QFtp::Binary);
while(CmdFinish){};
file->close();
};
};
}
To copy to clipboard, switch view to plain text mode
i dont recive any signal and i put a 0 k byte file on server.The signal startcommand, finishcommeand and progress( with 0 byte in done and total) are recived by slot only when i finish the myroutyne.
Any help
Thanks
Sorry for my english
Bookmarks