Important: Please read the Qt Code of Conduct -

QNetworkAccessManager: How to send data/file from ftp connection

  • I try to send data/file to current directory( folder that I want) from windows to Linux ?
    For this Firsltyi I tried to download some file from Linux.
    Here is my code:

    QUrl url("");
      QNetworkRequest request(url);
      manager=new QNetworkAccessManager(this);
      reply = manager->get(request);
      connect(reply, SIGNAL(readyRead()), SLOT(downloadReadyRead()));
      connect(reply, SIGNAL(finished()), SLOT(downloadFinished()));

    and secondly I tried Qt's example download manager and tried:

    QNetworkRequest request(url);
      QByteArray applicationUserName = "admin";
      QByteArray applicationUserPassword = "admin";
      currentDownload = manager.get(request);
      connect(currentDownload, SIGNAL(downloadProgress(qint64,qint64)),
      connect(currentDownload, SIGNAL(finished()),
      connect(currentDownload, SIGNAL(readyRead()),

    But it returns me:
    Failed: Logging in to failed: authentication required

    But when I try to connect from fileZilla with this authentication everything is ok.
    Do you have any suggestion to me.
    What I really want to do is: I want to upload my files into directories that I want from Windows to Linux by ftp connection (exactly like fileZille, almost same but I want to choose ip and path in my code as a hardcode )

    I will be plesuare for any help and suggestion.

  • Did you also set the username and password to the url in the second method?

  • @Bonnie No I just did that;

  • @MimCimm
    FTP should accept username and password in the url.
    But your first code snippet seems not having right design.
    So I think you should use the qt example, but set the username and password in the url as in the first method.

  • @Bonnie Unfortunatelly, İt also return

    Failed: Logging in to failed: authentication required

  • @MimCimm
    Verify the connection stuff saved/specified in your working FileZilla connector. For example, it might be using a different port. Anyway, check that out to make certain your code is trying to do the same.

  • I just setup a local ftp server and tested with the downloadmanager example, setting username and password to the url totally works.
    I got

    Downloading ftp://admin:admin@
    [###    ]      0.0 bytes/sec
    1/1 files downloaded successfully

  • This post is deleted!

Log in to reply