<?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: dropbox.filesUpload sometimes does not work in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609094#M2764</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1543035"&gt;@fangzefunny&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;... The large file cannot pass through the "post" operation, causing the problem of 413. ...&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1543035"&gt;@fangzefunny&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;For large files consider using upload sessions instead, not single upload. Every upload transaction is guaranteed to pass for no more than 150MB. In a session you can split the file content on pieces 150MB each, at most. In such a way you can upload significantly larger file. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@41457EF40051AFF130FDBFE21B496926/emoticons/1f609.png" alt=":winking_face:" title=":winking_face:" /&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jul 2022 16:06:15 GMT</pubDate>
    <dc:creator>Здравко</dc:creator>
    <dc:date>2022-07-12T16:06:15Z</dc:date>
    <item>
      <title>dropbox.filesUpload sometimes does not work</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/608918#M2760</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am now doing an online experiment via URL and trying to collect data using dropbox javascript SDK.&lt;/P&gt;
&lt;P&gt;At the end of the experiment, the success message was always prompted. But the data was not always uploaded to my dropbox.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;About 1/5 data was missing on the way to my dropbox.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have no idea why the data is missing and need help with possible reasons.&lt;/P&gt;
&lt;P&gt;Here is my code.&amp;nbsp; Each file is about 30kb, so the file size shouldn't be a problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know if this is the right way to place the question. Is any extra information needed?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;require("dotenv").config();
var Dropbox = require("dropbox").Dropbox;
const fetch = require("node-fetch");

const dbx = new Dropbox({
    accessToken: #############,
    refreshToken: #############,
    clientId: #############, 
    clientSecret: #############,
    fetch
});

var saveDropbox = function(content, filename){
    dbx.filesUpload({
        path: "/" + filename,
        contents: content 
    })
};
app.post("/experiment-data/:filename", function(request, response){
    // convert json to csv 
    DATA_CSV = json2csv(request.body); 
    var filename = request.params.filename;
    savedropbox(DATA_CSV, filename);
    response.end();
});

function(){
   var sel_data = jsPsych.data.get();
   $.ajax({
     type: "POST",
     url:  "/experiment-data/" + filename,
     data: JSON.stringify(sel_data.values()),
     contentType: "application/json"
     }).done(function(){
          alert("You have compeleted the experiment and your data has been 
          saved! ");
    }).fail(function(){
           alert("A problem occurs while writing data to Dropbox. "
          + "Data will be saved to your computer. ";
          var csv = sel_data.csv();
          downloadCSV(csv, fname);  
    });&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 08:57:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/608918#M2760</guid>
      <dc:creator>fangzefunny</dc:creator>
      <dc:date>2022-07-12T08:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: dropbox.filesUpload sometimes does not work</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609025#M2761</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1543035"&gt;@fangzefunny&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;At the end of the experiment, the success message was always prompted. But the data was not always uploaded to my dropbox.&amp;nbsp;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;PRE&gt;...
var saveDropbox = function(content, filename){
    dbx.filesUpload({
        path: "/" + filename,
        contents: content 
    })
};
...&lt;/PRE&gt;&lt;P&gt;...&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1543035"&gt;@fangzefunny&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;In your 'saveDropbox' function, what are you doing with Dropbox 'filesUpload' method result? On success there should be received a file metadata to the file just uploaded and on error - the corresponding error information. As far as I can see, you are ignoring this information. In this context, you function always succeeds regardless if actual upload succeeds or fails. The information of the error pointing the reason of an upload fail is lost too. That's why you never get any error message and your 'success message' always appears. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@41457EF40051AFF130FDBFE21B496926/emoticons/1f609.png" alt=":winking_face:" title=":winking_face:" /&gt; Be more careful.&lt;/P&gt;&lt;P&gt;Hope this gives direction.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 12:13:18 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609025#M2761</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2022-07-12T12:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: dropbox.filesUpload sometimes does not work</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609090#M2762</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1543035"&gt;@fangzefunny&lt;/a&gt;&amp;nbsp;Здравко is correct; you should check the response or error for the call, which you are currently ignoring. You can find &lt;A href="https://github.com/dropbox/dropbox-sdk-js/blob/main/examples/javascript/upload/index.html#L55" target="_self"&gt;an example of handling the response and error for an upload call with the Dropbox API v2 JavaScript SDK here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 15:48:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609090#M2762</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-07-12T15:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: dropbox.filesUpload sometimes does not work</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609093#M2763</link>
      <description>&lt;P&gt;Thanks! I found the reason today.&lt;BR /&gt;Sometimes, people make too many mistakes, making the (adaptive) experiment too long, and that causes the data file being too large. The large file cannot pass through the "post" operation, causing the problem of 413.&lt;BR /&gt;I was not able to see the error message before. I run it online, so I cannot see others' error messages. When I did it locally, I responded well, so the issue did not occur.&lt;/P&gt;&lt;P&gt;Anyway, thanks! It is not a problem with Dropbox!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 15:58:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609093#M2763</guid>
      <dc:creator>fangzefunny</dc:creator>
      <dc:date>2022-07-12T15:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: dropbox.filesUpload sometimes does not work</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609094#M2764</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1543035"&gt;@fangzefunny&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;... The large file cannot pass through the "post" operation, causing the problem of 413. ...&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1543035"&gt;@fangzefunny&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;For large files consider using upload sessions instead, not single upload. Every upload transaction is guaranteed to pass for no more than 150MB. In a session you can split the file content on pieces 150MB each, at most. In such a way you can upload significantly larger file. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@41457EF40051AFF130FDBFE21B496926/emoticons/1f609.png" alt=":winking_face:" title=":winking_face:" /&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 16:06:15 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609094#M2764</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2022-07-12T16:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: dropbox.filesUpload sometimes does not work</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609095#M2765</link>
      <description>&lt;P&gt;Got it! Thanks for great suggestions!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 16:08:14 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609095#M2765</guid>
      <dc:creator>fangzefunny</dc:creator>
      <dc:date>2022-07-12T16:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: dropbox.filesUpload sometimes does not work</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609104#M2766</link>
      <description>&lt;P&gt;That's correct; the &lt;A href="https://github.com/dropbox/dropbox-sdk-js/blob/main/examples/javascript/upload/index.html#L65" target="_blank"&gt;same example also shows how to use upload sessions for large files&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 16:51:58 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609104#M2766</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-07-12T16:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: dropbox.filesUpload sometimes does not work</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609114#M2767</link>
      <description>Thanks for the info!</description>
      <pubDate>Tue, 12 Jul 2022 18:35:45 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/dropbox-filesUpload-sometimes-does-not-work/m-p/609114#M2767</guid>
      <dc:creator>fangzefunny</dc:creator>
      <dc:date>2022-07-12T18:35:45Z</dc:date>
    </item>
  </channel>
</rss>

