Upload file with QAccessManager - problem with url

  • Hi, I got problem with typing good url address to upload file to my server. This is my whole code:

    @void FttpClient::ConnectWithServer()
    // create file
    QString filename="/home/vla/Documents/Data.txt";
    QFile file( filename );
    if ( file.open(QIODevice::ReadWrite) )
    QTextStream stream( &file );
    stream << "I write somethign hjeer e" << endl;

    // handle connection
    manager = new QNetworkAccessManager(this&#41;;
    connect(manager, SIGNAL(finished(QNetworkReply*&#41;&#41;,this, SLOT(replyFinished(QNetworkReply*)));
    qDebug("set url ");
    qDebug("set user name ");
    qDebug("set pw ");
    qDebug("set port");
    qDebug("put method from manager");
     qDebug("file closed");


    // and the last method when I get reply for posting
    // action
    void FttpClient::replyFinished (QNetworkReply *reply)
    qDebug("reply getted");
    qDebug() << "ERROR!";
    qDebug() << reply->errorString();
    qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
    qDebug() << reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString();
    qDebug() << reply->header(QNetworkRequest::ContentTypeHeader).toString();
    qDebug() << reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().toString();;
    qDebug() << reply->header(QNetworkRequest::ContentLengthHeader).toULongLong();
    qDebug() << reply->header(QNetworkRequest::CookieHeader).toString();
    qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
    qDebug() << reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString();



    when address look like in the code above, output which I got says me :

    " Cannot open ftp://userName:pw@blalala.bugs3.com:21/: is a directory"

    and the userName is the values set here:
    @ url.setUserName("userName");@
    the same with pw.

    When I try to add in url some directory like this

    bq. the output looks like this
    set url
    set user name
    set pw
    set port
    put method from manager
    file closed
    The program has unexpectedly finished.

    so I don't get any info, even response isn't invoked. I tried to set some file in url which should be created, but the result is the same as with adding directory to url so the app finishing unexpected...

    What is the problem here ?

    I would be grateful for any advices. If u need more details just give me a word.

    EDIT the url(ftp://blalala.bugs3.com/), user name and pw which I', using inside the code was tested with filezilla, so it's impossible that I putting wrong credential.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.