Results 1 to 2 of 2

Thread: How to upload image file in FTP server

  1. #1
    Join Date
    Nov 2012
    Location
    Coimbatore
    Posts
    53
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default How to upload image file in FTP server

    Hi ,
    I want to upload image file in ftp server but i'm not able to upload file in it.Any one give a solution and scratch code for uploading image file ftp server.

    Below is the scratch code which i have developed, this code is executed without an error but "bg.png" file is not uploaded in the server.

    QFTP *ftp=new QFtp;
    ftp->connectToHost("ipaddress");
    ftp->login("username","password");
    ftp->list();
    ftp->cd("directory name");
    // ftp->mkdir("test");
    // ftp->cd("test");
    ftp->put(new QFile("bg.png"),"bg.png");
    ftp->list();


    Thanks in advance

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to upload image file in FTP server

    Are you aware of the fact that QFtp operations are asynchronous ? Have you checked the "QFtp::error()" ?
    Btw. QFile pointer which you passed to "put" will leak, you should delete it after "put" command is finished. I also think you should open the file for reading before passing it to "put" method.

Similar Threads

  1. QFtp upload file to server
    By djo87 in forum Qt Programming
    Replies: 2
    Last Post: 30th May 2012, 01:55
  2. Upload file to HTTP server
    By produktdotestow in forum Qt Programming
    Replies: 5
    Last Post: 30th July 2011, 14:18
  3. How to upload file to HTTP server (POST Method)
    By Alex Snet in forum Qt Programming
    Replies: 8
    Last Post: 24th January 2011, 22:49
  4. QFtp:upload file to server
    By ensky_cy in forum Qt Programming
    Replies: 6
    Last Post: 14th December 2009, 10:42
  5. server upload
    By ag.sitesh in forum Qt Programming
    Replies: 1
    Last Post: 1st April 2008, 13:57

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.