FTP Upload using QNetworkAccessManager [QT]



  • Hello,

    Currently, I am trying to write a program which should upload a file to an FTP server. As recommended in the QT Docu., I chose to use QNetworkAccessManager's put function instead of QFtp. As far as I know, I should be able to access the FTP Server without using any security measures.

    QUrl uploadurl("ftp://ftp.drivehq.com/wwwhome/");
        uploadurl.setUserName("XXXXXX");
        uploadurl.setPassword("XXXXXX");
        uploadurl.setPort(21);
        QNetworkRequest upload(uploadurl);
        QNetworkAccessManager *uploadman = new QNetworkAccessManager(this);
        uploadman->put(upload, file);
    

    Basically, this is the code which should perform the upload.
    However, the file will not show up on the server. The file is about 1-2kb "big", and is opened as ReadWrite.
    Has anybody got an idea what I am doing wrong?

    Thank you for your time!

    cheers
    replax



  • afair there are some signals like "finished()" ... try to see if its emitted, if not check the longlivity of your objects - might be they get killed before the task is done. dont juse delete on the objects paricipating, use deleteLater(). hth


Anmelden zum Antworten