Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Uploading data to Tumblr API
Qt 6.11 is out! See what's new in the release blog

Uploading data to Tumblr API

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 2 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Reffy
    wrote on last edited by
    #1

    Hi,

    I've been at this issue for a while and just cannot solve the issue. Using the HTTP POST Method, I wish to send images or audio files to Tumblr. I always seem to get 403 - Bad Request issue when doing this. Sending text is no issue.

    Code below is what I'm using:

    @void Control::uploadPhoto(QString stringy)
    {
    qDebug() << stringy;
    QFile file("/home/user/MyDocs/Music/CuteTunes/Deluge.mp3");
    file.open(QIODevice::ReadOnly);
    QByteArray songArray;
    songArray = file.readAll();
    QUrl url1;
    url1.addEncodedQueryItem("email", "");
    url1.addEncodedQueryItem("password", "
    *");
    url1.addEncodedQueryItem("type", "audio");
    url1.addEncodedQueryItem("data", songArray);
    arrayPost = url1.encodedQuery();
    QNetworkRequest request;
    request.setUrl(QUrl("http://www.tumblr.com/api/write"));
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
    reply3 = manager.post(request, songArray);
    connect(reply3, SIGNAL(metaDataChanged()), this, SLOT(errorCheck()));
    }@

    Any help with this will be greatly appreciated. I have spent a very long time attempting to solve this issue.--

    Thanks in advance,

    Alex

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Did you check the output of url1.encodedQuery() ?

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Reffy
        wrote on last edited by
        #3

        It appears to be fine. Everything seems ok before the data is sent.

        Thanks for the help.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          I'm not 100% sure, but as far as I remember, QNetworkRequest does not support file upload out of the box. You will have to prepare the data (wrapping into MIME headers etc.) yourself.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved