Results 1 to 20 of 20

Thread: Qftp Put Image to FTP

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2010
    Posts
    41
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Qftp Put Image to FTP

    I am working with a screenshot upload method for a gaming client, its my first QT project and QT is growing on me fast, I like it! While the client is running, I want to upload screenshots to our ftp. I have looked into the documentation and have set up my project to add the QtNetwork for QFtp.
    The problem is everything seems to be working correctly, but after the code has been executed, there is not a image.png in my ftp.

    Qt Code:
    1. void PGC::shootScreen()
    2. {
    3.  
    4. originalPixmap = QPixmap(); // clear image for low memory situations
    5.  
    6. originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
    7.  
    8. QImage image;
    9. image = originalPixmap.toImage();
    10. QBuffer buffer(&ba);
    11. buffer.open(QIODevice::WriteOnly);
    12. image.save(&buffer, "PNG"); // writes image into ba in PNG format
    13.  
    14.  
    15.  
    16. if (!originalPixmap.save("test.png")) {
    17. // Saving didn't work
    18. QMessageBox::warning(this, "Saving error", "Could not save the file. Check the plugins!");
    19. }
    20.  
    21. QFtp* connection = new QFtp();
    22. QObject::connect(connection, SIGNAL(done(bool)), this, SLOT(quit()));
    23. connection->connectToHost(ftphost);
    24. connection->login(user, password);
    25. //connection->cd("SS");
    26.  
    27. if (!connection->put(ba, "test.png", QFtp::Binary)) {
    28. // FTP SS didn't work
    29. QMessageBox::warning(this, "FTP SS Error", "Could not save the SS to FTP!");
    30. }
    31.  
    32. connection->close( );
    33.  
    34. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by harleyskater; 28th June 2010 at 06:10.

Similar Threads

  1. QFtp and dataTransferProgress
    By racinglocura07 in forum Qt Programming
    Replies: 2
    Last Post: 24th June 2010, 18:14
  2. Synchronous QFtp?
    By aarpon in forum Qt Programming
    Replies: 2
    Last Post: 26th October 2009, 09:28
  3. QFtp over QHttp
    By parusri in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2009, 19:16
  4. Synchronizing QFtp
    By arun_vj in forum Qt Programming
    Replies: 0
    Last Post: 5th November 2008, 12:31
  5. Replies: 0
    Last Post: 23rd September 2007, 11:54

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
  •  
Qt is a trademark of The Qt Company.