简体   繁体   中英

QT-FTP Upload Error

I'm trying to upload a simple txt file to ftp server but getting "QNetworkReply::ContentOperationNotPermittedError" reply from the server and i think it is about my file hierarchy.

Here is the file order of my ftp server and my qt-ftp configuration :

档案顺序FTP信息

    QUrl url("f13-preview.125mb.com/www/home/repo/test.txt");
    url.setHost("f13-preview.125mb.com");
    url.setUserName("1896230");
    url.setPassword("mypassword");
    url.setPath("f13-preview.125mb.com/www/home/repo/");
    url.setScheme("ftp");

I can't get, why do you use QNetwork instead awesome QFtp module , that provides all necessary for work with ftp?

QFtp *ftp = new QFtp(parent);
ftp->connectToHost("f13-preview.125mb.com");
ftp->login("1896230", "mypassword");

and then use QFtp::put . That's all you need.

I've changed the QUrl as below and solved the problem, don'T know why but now i'm struglinng with segmentation fault.

QUrl url("fftp://f13-preview.125mb.com/repo/test.txt");
    if(url.isValid())
    {
        url.setHost("f13-preview.125mb.com");
        url.setUserName("1896230");
        url.setPassword("mypassword");
        url.setScheme("ftp");
        url.setPort(21);
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM