Results 1 to 3 of 3

Thread: FTP Upload using QNetworkAccessManager

  1. #1
    Join Date
    Nov 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default FTP Upload using QNetworkAccessManager

    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.

    Qt Code:
    1. QUrl uploadurl("ftp://ftp.drivehq.com/wwwhome/");
    2. uploadurl.setUserName("XXXXXX");
    3. uploadurl.setPassword("XXXXXX");
    4. uploadurl.setPort(21);
    5. QNetworkRequest upload(uploadurl);
    6. QNetworkAccessManager *uploadman = new QNetworkAccessManager(this);
    7. uploadman->put(upload, file);
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: FTP Upload using QNetworkAccessManager

    Could be almost anything. If you didn't discard the QNetworkReply* returned by QNetworkAccessManager::put() you could look at its QNetworkReply::error() for some insight.

  3. #3
    Join Date
    Jul 2013
    Posts
    33
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: FTP Upload using QNetworkAccessManager

    This thread is expired i feel.just this update is for users to know..
    change 1st line to;
    Qt Code:
    1. QUrl uploadurl("ftp://ftp.drivehq.com/wwwhome/xxxx");
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. youtube upload
    By ernie in forum Qt Programming
    Replies: 15
    Last Post: 2nd September 2015, 15:29
  2. Replies: 1
    Last Post: 21st October 2010, 05:59
  3. Replies: 5
    Last Post: 20th January 2009, 15:11
  4. upload files using QNetworkAccessManager
    By Raajesh in forum Qt Programming
    Replies: 1
    Last Post: 30th June 2008, 20:43
  5. server upload
    By ag.sitesh in forum Qt Programming
    Replies: 1
    Last Post: 1st April 2008, 14:57

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.