Results 1 to 7 of 7

Thread: QFtp:upload file to server

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Location
    China
    Posts
    20
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Question QFtp:upload file to server

    I am confusing of uploading file to server.
    I want know how I specified the path in the server.The file ,that will be uploaded,should be open,and copy to memory,then upload to the file which I created in the server...
    May be I don't explain it clear,I just want to konw the process how the file upload to the server.
    Thank you!!
    Qt Code:
    1. int i = 0;
    2. QString filename;
    3. QString files = QFileDialog::getOpenFileName(this, tr("Select File"),
    4. "D://");
    5.  
    6. if (files.isEmpty())
    7. return;
    8.  
    9. while(files.indexOf("/", i) != (-1)) //find the file name not include the full url
    10. i = files.indexOf("/",i) + 1;
    11. while(i < files.size())
    12. {
    13. filename.append(files.at(i));
    14. i++;
    15. }
    16.  
    17. file = new QFile(filename);
    18. Q_ASSERT(file != NULL);
    19.  
    20. if(!file->open(QIODevice::ReadWrite)) //finished create the file in the debug file
    21. {
    22. qDebug() << "opern err" << file->fileName();
    23. return;
    24. }
    25.  
    26. ftp->put(file,filename);
    To copy to clipboard, switch view to plain text mode 
    After the ftp->put , I find there is no file in the server directory.
    Last edited by ensky_cy; 14th December 2009 at 05:12.

Similar Threads

  1. 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
  2. Read binary from file
    By weldpua2008 in forum Newbie
    Replies: 2
    Last Post: 3rd April 2009, 23:50
  3. How to download any file through ftp server
    By thomasjoy in forum Qt Programming
    Replies: 1
    Last Post: 24th July 2007, 01:23
  4. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 15:21
  5. Enctrypted file uploads to a server
    By hardgeus in forum Qt Programming
    Replies: 3
    Last Post: 11th December 2006, 23:10

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.