<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Unknown error on upload in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unknown-error-on-upload/m-p/440888#M23155</link>
    <description>&lt;P&gt;Thank you Greg, for your prompt answer.&lt;/P&gt;&lt;P&gt;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!).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jul 2020 05:29:17 GMT</pubDate>
    <dc:creator>philman</dc:creator>
    <dc:date>2020-07-28T05:29:17Z</dc:date>
    <item>
      <title>Unknown error on upload</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unknown-error-on-upload/m-p/440772#M23153</link>
      <description>&lt;P&gt;Dear support,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;Do you what is wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here the code in QT Creator I wrote:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;dropbox.h&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;#ifndef DROPBOX_H
#define DROPBOX_H

#include &amp;lt;QObject&amp;gt;
#include &amp;lt;QtNetwork/QNetworkAccessManager&amp;gt;

class DropBox : public QNetworkAccessManager
{
    Q_OBJECT

public:
    explicit DropBox(QObject *parent = nullptr) : QNetworkAccessManager(parent) {}
    void upload(const QString filename);

signals:

public slots:

private:
    
};

#endif // DROPBOX_H&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;dropbox.cpp&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;#include "dropbox.h"

#include &amp;lt;QFile&amp;gt;
#include &amp;lt;QNetworkReply&amp;gt;

void DropBox::upload(const QString filename)
{
    QNetworkRequest request(QUrl("https://content.dropboxapi.com/2/files/upload"));

    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);
    file-&amp;gt;open(QIODevice::ReadOnly);
    QByteArray content = file-&amp;gt;readAll();
    request.setRawHeader(QByteArray("Content-Length"), QByteArray::number(content.size()));

    QNetworkReply *reply = this-&amp;gt;post(request, content);

    QObject::connect(reply,
                     &amp;amp;QNetworkReply::finished,
                     [=](){
                        QString err = reply-&amp;gt;errorString();
                        QString contents = QString::fromUtf8(reply-&amp;gt;readAll());
                        qInfo() &amp;lt;&amp;lt; "Error:" &amp;lt;&amp;lt; err;});
}&lt;/PRE&gt;
&lt;P&gt;In the above code, please replace the automatic emoji with "opening bracket equal sign closing bracket"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please tell me if you need more information on how to compile and run this code with Qt Creator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Philman&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2020 23:06:34 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unknown-error-on-upload/m-p/440772#M23153</guid>
      <dc:creator>philman</dc:creator>
      <dc:date>2020-09-04T23:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Unknown error on upload</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unknown-error-on-upload/m-p/440791#M23154</link>
      <description>&lt;P&gt;I don't believe the "unknown error" message is coming from&amp;nbsp;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you enable any extra logging or verbose mode though? If the&amp;nbsp;Dropbox API request itself is failing, the&amp;nbsp;Dropbox API HTTPS response would contain a more helpful error message.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 21:02:37 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unknown-error-on-upload/m-p/440791#M23154</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-07-27T21:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Unknown error on upload</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unknown-error-on-upload/m-p/440888#M23155</link>
      <description>&lt;P&gt;Thank you Greg, for your prompt answer.&lt;/P&gt;&lt;P&gt;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!).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 05:29:17 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Unknown-error-on-upload/m-p/440888#M23155</guid>
      <dc:creator>philman</dc:creator>
      <dc:date>2020-07-28T05:29:17Z</dc:date>
    </item>
  </channel>
</rss>

