ftp
->setTransferMode
(QFtp::Passive);
//connect(ftp,SIGNAL(commandFinished ( int, bool)),this,SLOT(fincommande()));
ftp->connectToHost("ftp.icwus.net",21);
//setValueProgressBar(25);
connect(ftp, SIGNAL(stateChanged(int)), this, SLOT(showNewState(int)));
connect( ftp, SIGNAL( commandFinished( int, bool )),this, SLOT( ftp_commandFinished( int, bool )) );
connect( ftp, SIGNAL( commandFinished( int, bool )),this, SLOT( ftp1_commandFinished( int, bool )) );
ftp->login("mylogin","mypassword");
ftp->cd("acrgafsa");
ftp->mkdir("timetables");
ftp->cd("timetables");
int i = 0;
"D://");
if (files.isEmpty())
return;
while(files.indexOf("/", i) != (-1)) //find the file name not include the full url
i = files.indexOf("/",i) + 1;
while(i < files.size())
{
filename.append(files.at(i));
i++;
}
Q_ASSERT(file != NULL);
if(!file
->open
(QIODevice::ReadWrite)) //finished create the file in the debug file {
qDebug() << "opern err" << file->fileName();
return;
}
ftp->put(file,filename);
QFtp *ftp = new QFtp(this);
ftp->setTransferMode(QFtp::Passive);
//connect(ftp,SIGNAL(commandFinished ( int, bool)),this,SLOT(fincommande()));
ftp->connectToHost("ftp.icwus.net",21);
//setValueProgressBar(25);
connect(ftp, SIGNAL(stateChanged(int)), this, SLOT(showNewState(int)));
connect( ftp, SIGNAL( commandFinished( int, bool )),this, SLOT( ftp_commandFinished( int, bool )) );
connect( ftp, SIGNAL( commandFinished( int, bool )),this, SLOT( ftp1_commandFinished( int, bool )) );
ftp->login("mylogin","mypassword");
ftp->cd("acrgafsa");
ftp->mkdir("timetables");
ftp->cd("timetables");
int i = 0;
QString filename;
QString files = QFileDialog::getOpenFileName(this, tr("Select File"),
"D://");
if (files.isEmpty())
return;
while(files.indexOf("/", i) != (-1)) //find the file name not include the full url
i = files.indexOf("/",i) + 1;
while(i < files.size())
{
filename.append(files.at(i));
i++;
}
QFile *file = new QFile(filename);
Q_ASSERT(file != NULL);
if(!file->open(QIODevice::ReadWrite)) //finished create the file in the debug file
{
qDebug() << "opern err" << file->fileName();
return;
}
ftp->put(file,filename);
To copy to clipboard, switch view to plain text mode
Bookmarks