I know this is a Major Noob question, but all the examples i can find are of an FTP GET not an FTP PUT. I have several of the books on QT, nothing on Opening a file and PUTing it..


All i want to do is see some examples of opening a file and using QFTP PUTing it to a remote ftp as anonymous

The transfer must be binary safe.

I have this code to update a combo box with a filename from a browse button...
Qt Code:
  1. void Window::browse()
  2. {
  3. QString directory = QFileDialog::getOpenFileName(this,
  4. tr("Open File"), QDir::currentPath());
  5. if (!directory.isEmpty()) {
  6. directoryComboBox->addItem(directory);
  7. directoryComboBox->setCurrentIndex(directoryComboBox->currentIndex() + 1);
  8. }
  9. }
To copy to clipboard, switch view to plain text mode 

This works fine, then when they push Send it calls "sendFile", but I cannot link the "directoryComboBox" to the QFTP PUT... and send it to the server.

Send File Code...
Qt Code:
  1. void Window::sendFile()
  2. {
  3.  
  4. cancelButton->setEnabled(true);
  5.  
  6. ftp = new QFtp(this);
  7.  
  8. /* This holds the remote server IP Address */
  9. ftp->connectToHost(printerComboBox->currentText());
  10.  
  11. /* These Status labels are broken they work but show sending file allways, need to do better checking later */
  12. statusLabel->setText(tr("Connecting to printer at %1 using FTP")
  13. .arg(printerComboBox->currentText()));
  14. ftp->login();
  15.  
  16. statusLabel->setText(tr("%1 - Logging in...")
  17. .arg(printerComboBox->currentText()));
  18.  
  19. /* NEED TO REPLACE THIS WITH THE PROPER FILE OPEN AND SEND */
  20. ftp->list();
  21.  
  22. statusLabel->setText(tr("%1 - Sending File...")
  23. .arg(printerComboBox->currentText()));
  24. }
To copy to clipboard, switch view to plain text mode 

I put in the "list();" command where the FTP PUT should be to make sure that the QFTP was doing something on the network, which it does. Now i need to actually open the file and send it.

Thanks all, this is my first ... Real (one that does something) QT network APP. Thanks for the assistance.