Can't get FTP Connection

  • Hello Community,
    I'm trying to upload a file to my FTP Server (Filezilla, running on localhost). But for some reason I don't get any connection. Neither do I get any errors by Qt. Here a code snippet:

    void Upload::upload_video(){
        QString filename = "cut.mp4";
        QFile file(filename);
        QUrl uploadurl("ftp://localhost/cut.mp4");
        QNetworkRequest upload(uploadurl);
        QNetworkAccessManager *uploadman = new QNetworkAccessManager(this);
        uploadman->put(upload, &file);

    I have checked for errors aswell already, using this code:

        connect(reply, &QNetworkReply::finished, this, &Upload::get_reply);
        connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(requestError(QNetworkReply::NetworkError)));
        void Upload::get_reply() {

    I don't get any connection tries in my FileZilla Server logs, but I don't get any errors either. I hope somebody can help me :(


  • I don't think this is how you do FTP. Seems like you are doing an HTTP put request

  • @asanka424 Really? Then I'm confused. The normal QFtp Class was removed(or not tupported anymore) as far as I know and this is the only example on FTP that I could find. :( Sorry if I'm wrong. Could anyone show me an example for FTP then? Or link me a site that explains how to. On Google I only find examples that are like my code :S

    Anyway, thanks for the answer :)

  • Sorry I didn't see your URL.
    However are you assigning output of your put() to a network reply?

  • Lifetime Qt Champion


    QFtp for Qt 5 can be found here

  • @SGaist Hey, thanks man! :) But I heard that it is pretty unsafe, is that true? :S And also, if I use it in one of my programs, can the user somehow read out the password? :o

  • @SGaist
    I'm trying to get qftp running atm. I'm trying to build the qftp project, but I get the error

    :-1: Fehler: Failed to run: perl -w C:\Qt\5.5\msvc2013\bin\ -module QtFtp -version 5.0.0 -outdir C:/Qtsrc/qt-everywhere-opensource-src-5.5.1/build-qtftp-Desktop_Qt_5_5_1_MSVC2013_32bit-Debug C:/Qtsrc/qt-everywhere-opensource-src-5.5.1/qtftp

    So I googled it and found another thread where somebody had the same problem. He just installed perl and it worked for him. So I just installed perl aswell, but it's still not working. I heard that I need to add the Perl path somehwere or something but I'm not sure and even if I dont know how to. I hope you can help me :(

  • Lifetime Qt Champion

    If you want to make perl accessible system wide, then you have to modify the PATH environment variable.

    As for safety, don't put a password inside your application code but that's valid for any service.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.