Showing results for 
Show  only  | Search instead for 
Did you mean: 
Back again with another edition of 'How we use Dropbox', so find out how Ross uses Dropbox to answer some new house questions here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unknown error on upload

Unknown error on upload

Explorer | Level 4

Dear support,


I would like to upload files to my Dropbox Application via Qt in c++ but it returns "unknown error" despite the "curl -X POST" equivalent is working like a charm in CLI mode.

Do you what is wrong?


Here the code in QT Creator I wrote:


#ifndef DROPBOX_H
#define DROPBOX_H

#include <QObject>
#include <QtNetwork/QNetworkAccessManager>

class DropBox : public QNetworkAccessManager

    explicit DropBox(QObject *parent = nullptr) : QNetworkAccessManager(parent) {}
    void upload(const QString filename);


public slots:


#endif // DROPBOX_H


#include "dropbox.h"

#include <QFile>
#include <QNetworkReply>

void DropBox::upload(const QString filename)
    QNetworkRequest request(QUrl(""));

    request.setRawHeader(QByteArray("Authorization"), QByteArray("Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"));
    QString dropboxArg = QString("{\"path\": \"/mouvdetect/QtHumanDetector/%1\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}").arg(filename);
    request.setRawHeader(QByteArray("Dropbox-API-Arg"), dropboxArg.toUtf8());
    request.setRawHeader(QByteArray("Content-Type"), QByteArray("application/octet-stream"));

    QFile *file = new QFile(filename);
    QByteArray content = file->readAll();
    request.setRawHeader(QByteArray("Content-Length"), QByteArray::number(content.size()));

    QNetworkReply *reply = this->post(request, content);

                        QString err = reply->errorString();
                        QString contents = QString::fromUtf8(reply->readAll());
                        qInfo() << "Error:" << err;});

In the above code, please replace the automatic emoji with "opening bracket equal sign closing bracket"


Please tell me if you need more information on how to compile and run this code with Qt Creator.


Best regards,


2 Replies 2

Re: Unknown error on upload


I don't believe the "unknown error" message is coming from Dropbox itself, so it's likely coming from the client you're using. We can't provide support for the client itself though, as it's not made by Dropbox.


Can you enable any extra logging or verbose mode though? If the Dropbox API request itself is failing, the Dropbox API HTTPS response would contain a more helpful error message.

Re: Unknown error on upload

Explorer | Level 4

Thank you Greg, for your prompt answer.

In fact, the message "unknown error" was thrown even if the file was well uploaded (so I was confused and I didn't check before if the file was effectively uploaded or not... oh my!).


Who's talking

Top contributors to this post

  • User avatar
    philman Explorer | Level 4
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?