Results 1 to 4 of 4

Thread: Couldn't change current directory in windows's QT

  1. #1
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Couldn't change current directory in windows's QT

    Following program is to upload a file from local system to a remote sever.But the file on server after uploading have zero bytes.Correct uploading take place only when i put the file to upload in my application's release folder.Changing the current directory failed.Please help me..

    Qt Code:
    1. if(QDir::setCurrent(path))
    2. qDebug()<<"path set";
    3. else
    4. qDebug()<<"Couldn't set path";
    5. QFile *file = new QFile(filename);
    6. file->open( QIODevice::ReadWrite );
    7. ftp.connectToHost("192.100.1.00");
    8. ftp.login("ftp","ftp");
    9. QFileInfo fi(media);
    10. ftp.put(file,fi.fileName(),QFtp::Binary);
    11. ftp.close();
    To copy to clipboard, switch view to plain text mode 
    Last edited by marcel; 24th February 2008 at 12:46. Reason: missing [code] tags
    @shish

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Couldn't change current directory in windows's QT

    QFtp::put returns a command ID. You must save this ID and connect a slot to the QFtp::commandFinished signal. When you get that ID you can be sure that the upload has been completed and close the connection.

    Your current code closes the connection immediately, there is no transfer performed.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Couldn't change current directory in windows's QT

    Quote Originally Posted by marcel View Post
    Your current code closes the connection immediately, there is no transfer performed.
    QFtp::close() only schedules a disconnection - it doesn't perform it immediately.

    @sinha.ashish: What is the contents of "filename"?

  4. #4
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default

    Thanks for the post. Problem solved...there was a problem in seting path of file to be uploaded now it is corrected
    Last edited by jpn; 25th February 2008 at 07:44. Reason: two posts merged
    @shish

Similar Threads

  1. Qt designer plugin errors on OSX Leopard
    By mpotocnik in forum Qt Tools
    Replies: 10
    Last Post: 21st January 2008, 09:45
  2. Distributing QT application for Mac OS
    By mb0 in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2007, 18:59
  3. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21
  4. Replies: 15
    Last Post: 21st April 2007, 17:46
  5. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 12:54

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.