0

I am trying to upload files using Rapidshare API and Qt. The API can be called via POST method with all the parameters in POST method.

I am able to upload the file but if the file contain characters like '&', the file not gets fully uploaded(in a way i am getting corrupted file when downloadin the same from rapidshare).

I am doin it thru following code:

    QByteArray postData;

    postData.append(QString("sub=upload&login=%1&password=%2&filename=%3").arg(...).arg(...).arg(...));

    QByteArray data;    

    if(FileMan.ReadFromDataFile(data) == true){
         // Read file data
    }

    postData.append("&filecontent=").append(data);

    ...

    QNetworkReply *reply = manager->post(request, postData);

    connect(reply, SIGNAL(finished()), this, SLOT(onUploadCompleted()));

    ...

While posting the file data why rapidshare interprets character like '&' as query seperator also i compared original file with uploaded file using hex dump and found its interpreting 'CR' char also. I tried with setting raw headers but to no avail.

How to send binary data as it is to rapidshare using the API. Please let me know if i am missing something.

cyber_raj
  • 1,780
  • 1
  • 14
  • 25
  • Don't you have to encode the file somehow and set the _Content-Transfer-Encoding_ header field? – scai Aug 03 '12 at 08:59

1 Answers1

1

postData.append("&filecontent=").append(data.toPercentEncoding());

Pavel Zdenek
  • 7,146
  • 1
  • 23
  • 38