Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't get FTP Connection

Can't get FTP Connection

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AlanT1337A Offline
    AlanT1337A Offline
    AlanT1337
    wrote on last edited by AlanT1337
    #1

    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");
        uploadurl.setUserName("user");
        uploadurl.setPassword("password");
        QNetworkRequest upload(uploadurl);
        QNetworkAccessManager *uploadman = new QNetworkAccessManager(this);
        uploadman->put(upload, &file);
        qDebug()<<"Done"<<endl;
    }
    

    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)));
        //and
        void Upload::get_reply() {
            qDebug()<<"finished!!!";
        }
    

    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 :(

    Greets
    Steven

    1 Reply Last reply
    0
    • A Offline
      A Offline
      asanka424
      wrote on last edited by
      #2

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

      AlanT1337A 1 Reply Last reply
      0
      • A asanka424

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

        AlanT1337A Offline
        AlanT1337A Offline
        AlanT1337
        wrote on last edited by
        #3

        @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 :)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          asanka424
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            QFtp for Qt 5 can be found here

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            AlanT1337A 2 Replies Last reply
            0
            • SGaistS SGaist

              Hi,

              QFtp for Qt 5 can be found here

              AlanT1337A Offline
              AlanT1337A Offline
              AlanT1337
              wrote on last edited by
              #6

              @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

              1 Reply Last reply
              0
              • SGaistS SGaist

                Hi,

                QFtp for Qt 5 can be found here

                AlanT1337A Offline
                AlanT1337A Offline
                AlanT1337
                wrote on last edited by
                #7

                @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\syncqt.pl -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 :(

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  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.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved