Uploading files to the FTP server
Since we don't have any files in our FTP directory yet (except the file list), let's write the code to allow us to upload our first file.
- First, open
mainwindow.uiand right click on theOpenbutton. Then, selectGo to slotand select theclicked()option:

- A
slotfunction will be automatically created for you. Then, add the following code to the function to open up the file selector window for our users to select their desired file for upload:
void MainWindow::on_openButton_clicked()
{
QString fileName = QFileDialog::getOpenFileName(this, "Select
File", qApp->applicationDirPath());
ui->uploadFileInput->setText(fileName);
}- After that, repeat this step and do the same for the
Uploadbutton. This time, the code for itsslotfunction looks something like the following:
void MainWindow::on_uploadButton_clicked()
{
QFile* file = new QFile(ui->uploadFileInput->text());
QFileInfo fileInfo(*file);
uploadFileName = fileInfo.fileName...