<?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: Corrupt saved file if I first don't save to disk (node) in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Corrupt-saved-file-if-I-first-don-t-save-to-disk-node/m-p/385023#M21407</link>
    <description>&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1243398"&gt;@smr_software&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Did you take care for file decoding, not directly forward it?! Usually files get encoded somehow (base64, gzip,.. etc.) before transmitted from clients browser. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@F55D1311E4D274BF094217A54A6087D3/images/emoticons/1f609.png" alt=":wink:" title=":wink:" /&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Dec 2019 15:54:40 GMT</pubDate>
    <dc:creator>Здравко</dc:creator>
    <dc:date>2019-12-18T15:54:40Z</dc:date>
    <item>
      <title>Corrupt saved file if I first don't save to disk (node)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Corrupt-saved-file-if-I-first-don-t-save-to-disk-node/m-p/385005#M21406</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using the api to save a file to &lt;EM&gt;Dropbox&lt;/EM&gt; from node (meteor). My problem is, if I don't first save to disk (node) but directly to Dropbox, the result is a corrupted file.&amp;nbsp; Otherwise, If I first&amp;nbsp; save to node, read, and then save to DB, the file is saved perfect.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In&amp;nbsp; the client (browser) I receive the file from the user and pass this:&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;file.srcElement.&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;result&lt;/STRONG&gt;&lt;/EM&gt; to server (node).&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In server, I write the file to disk:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;await&amp;nbsp;writeFileAsync(fileName,&amp;nbsp;blob,&amp;nbsp;encoding)&amp;nbsp;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;then read it from disk&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;fileContent&amp;nbsp;=&amp;nbsp;await&amp;nbsp;readFileAsync(fileName);&amp;nbsp;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;get my Dropbox token ...&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;write to Dropbox :&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;await&amp;nbsp;dbx.filesUpload({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;path:&amp;nbsp;fileName,&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;contents:&amp;nbsp;fileContent,&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mode:&amp;nbsp;{&amp;nbsp;".tag":&amp;nbsp;"overwrite"&amp;nbsp;},&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;autorename:&amp;nbsp;false&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;})&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Everything works perfect and I can see the file is perfectly written to DB. Nevertheless,&amp;nbsp; I don't want to save the content first to disk, in order to save then to DB.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Can somebody help me undertand what I'm missing here?&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Many thanks and bye ...&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 18 Mar 2020 09:20:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Corrupt-saved-file-if-I-first-don-t-save-to-disk-node/m-p/385005#M21406</guid>
      <dc:creator>smr_software</dc:creator>
      <dc:date>2020-03-18T09:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Corrupt saved file if I first don't save to disk (node)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Corrupt-saved-file-if-I-first-don-t-save-to-disk-node/m-p/385023#M21407</link>
      <description>&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1243398"&gt;@smr_software&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Did you take care for file decoding, not directly forward it?! Usually files get encoded somehow (base64, gzip,.. etc.) before transmitted from clients browser. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@F55D1311E4D274BF094217A54A6087D3/images/emoticons/1f609.png" alt=":wink:" title=":wink:" /&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2019 15:54:40 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Corrupt-saved-file-if-I-first-don-t-save-to-disk-node/m-p/385023#M21407</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2019-12-18T15:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Corrupt saved file if I first don't save to disk (node)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Corrupt-saved-file-if-I-first-don-t-save-to-disk-node/m-p/385049#M21409</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1243398"&gt;@smr_software&lt;/a&gt; The&amp;nbsp;Dropbox&amp;nbsp;filesUpload method will just upload the data supplied to it, so to follow on what Здравко said, it sounds like the issue is&amp;nbsp;occurring before the&amp;nbsp;Dropbox call. It may have to do with whatever format or encoding the data is in when you get it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since this isn't exactly about the&amp;nbsp;Dropbox API itself, I'm afraid I can't offer much help. You may be better suited asking about how to handle data like this in Node/Meteor in a more general forum, such as StackOverflow, or one specific to Node or Meteor. I also&amp;nbsp;recommend adding some logging first to inspect the data through your code to see what is different and where.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2019 17:25:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Corrupt-saved-file-if-I-first-don-t-save-to-disk-node/m-p/385049#M21409</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-12-18T17:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Corrupt saved file if I first don't save to disk (node)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Corrupt-saved-file-if-I-first-don-t-save-to-disk-node/m-p/385126#M21418</link>
      <description>&lt;P&gt;Well, yes, I suppose both answers are in a way ansewring the issue. It's not a DB issue but an encoding one. I'll research a little bit about this, or maybe try in another forum, a more general one, like Stackoverflow.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course if I find the solutions I'll post it back here.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for your help and bye ...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2019 22:39:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Corrupt-saved-file-if-I-first-don-t-save-to-disk-node/m-p/385126#M21418</guid>
      <dc:creator>smr_software</dc:creator>
      <dc:date>2019-12-18T22:39:50Z</dc:date>
    </item>
  </channel>
</rss>

