Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to upload the Image to server in blackberry 10 cascades?
    primarykey
    data
    text
    <p>I have tried the following code for image uploading,in this code am able to get the response from server but the image size is always zero in server.Can anyone help me about this regards,</p> <pre><code> void App::uploadImage(){ QString path(QDir::currentPath() + "/app/native/assets/Icon/img.jpg"); QNetworkRequest request( QUrl( "http://domain.com?type=uploadimages&amp;deviceid=12323")); QByteArray boundary = "-------------------------32142544626177"; QFile file(path); if (!file.open(QIODevice::ReadOnly)) { qDebug() &lt;&lt; "error read image"; return; } QByteArray fileContent(file.readAll()); QByteArray data = "--" + boundary + "\r\n"; data += "Content-Disposition: form-data; name=\"data\"; filename=\"img.jpg\";\r\n"; data += "Content-Type: image/jpg\r\n\r\n" + fileContent + "\r\n"; data += "--" + boundary + "--\r\n"; request.setRawHeader("Content-Type", "multipart/form-data; boundary=" + boundary); request.setRawHeader("Content-Length", QString::number(data.size()).toAscii()); file.close(); qDebug() &lt;&lt; "data" &lt;&lt; data.size(); QNetworkAccessManager *am = new QNetworkAccessManager(this); QNetworkReply *reply = am-&gt;post(request, "&amp;data=" +data); QObject::connect(am, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*))); } void App::replyFinished(QNetworkReply* reply) { reply-&gt;open(QIODevice::ReadOnly); if (reply-&gt;error() == QNetworkReply::NoError) { QByteArray str = (reply-&gt;readAll()); QString response = QString::fromUtf8(str.data(), str.size()); qDebug() &lt;&lt; " response " &lt;&lt; response; } else{ qDebug() &lt;&lt; "error response server"; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload