<?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: Problem uploading converted image file(.dng) into dropbox in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-uploading-converted-image-file-dng-into-dropbox/m-p/474602#M24093</link>
    <description>&lt;P&gt;Have you checked what the value of your 'data' variable is? Does it contain the expected file contents?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I notice you aren't checking the 'err' variable for the&amp;nbsp;readFile call, so you may not be catching any errors that are occurring when reading the file. You should update your code to check that.&lt;/P&gt;</description>
    <pubDate>Mon, 30 Nov 2020 17:55:40 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2020-11-30T17:55:40Z</dc:date>
    <item>
      <title>Problem uploading converted image file(.dng) into dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-uploading-converted-image-file-dng-into-dropbox/m-p/473911#M24063</link>
      <description>&lt;P&gt;I have an application in node js in which I am uploading the image to the node server after that&amp;nbsp; I compress the file to reduce the size. After that, I upload it to dropbox but the uploaded file has a 0-byte size. I don't understand the problem. Below is the code that I used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;var&amp;nbsp;dir&amp;nbsp;="C:\\Users\\uploads\\converted\\"+foldername;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fs.readdir("C:\\Users\\uploads\\converted\\"+foldername,&amp;nbsp;function&amp;nbsp;(err,&amp;nbsp;files)&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;//handling&amp;nbsp;error
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;(err)&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;return&amp;nbsp;console.log('Unable&amp;nbsp;to&amp;nbsp;scan&amp;nbsp;directory:&amp;nbsp;'&amp;nbsp;+&amp;nbsp;err);
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&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;//listing&amp;nbsp;all&amp;nbsp;files&amp;nbsp;using&amp;nbsp;forEach
&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;files.forEach(function&amp;nbsp;(file)&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;console.log(file);&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;dbx&amp;nbsp;=&amp;nbsp;new&amp;nbsp;Dropbox({&amp;nbsp;accessToken:&amp;nbsp;'xxxx'&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;dbx.filesUpload({path:&amp;nbsp;'/'+link+'/'+file&amp;nbsp;,&amp;nbsp;contents:&amp;nbsp;file.data})
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.then(function(response)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;console.log(response);
&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.catch(function(error)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;console.error(error);
&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;&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;});
&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;&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;});&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 28 Nov 2020 08:16:59 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-uploading-converted-image-file-dng-into-dropbox/m-p/473911#M24063</guid>
      <dc:creator>JagsDew</dc:creator>
      <dc:date>2020-11-28T08:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problem uploading converted image file(.dng) into dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-uploading-converted-image-file-dng-into-dropbox/m-p/473967#M24078</link>
      <description>&lt;P&gt;[Cross-linking for reference:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/65039727/problem-uploading-converted-image-file-dng-into-dropbox" target="_self"&gt;https://stackoverflow.com/questions/65039727/problem-uploading-converted-image-file-dng-into-dropbox&lt;/A&gt; ]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When uploading a file to&amp;nbsp;Dropbox via &lt;A href="https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesUpload__anchor" target="_self"&gt;the&amp;nbsp;filesUpload method&lt;/A&gt; in &lt;A href="https://github.com/dropbox/dropbox-sdk-js" target="_self"&gt;the official&amp;nbsp;Dropbox API v2 JavaScript SDK&lt;/A&gt;, you need to pass in the file data to upload as the "contents" parameter in the&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-js/global.html#FilesCommitInfo" target="_self"&gt;FilesCommitInfo&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your code, I see you're passing in the 'file.data' variable, but this apparently does not contain any data and so your uploaded file is empty. I see you're calling&amp;nbsp;&lt;A href="https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback" target="_self"&gt;fs.readdir&lt;/A&gt; to get the list of files in the folder, but that does not actually give you the file data for each file. It just gives you the file name. You'll need to instead get the file data from the local filesystem and pass it to&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesUpload__anchor" target="_self"&gt;the&amp;nbsp;filesUpload method&lt;/A&gt;, e.g., perhaps using &lt;A href="https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback" target="_self"&gt;the&amp;nbsp;fs.readFile method&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 18:23:40 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-uploading-converted-image-file-dng-into-dropbox/m-p/473967#M24078</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-11-27T18:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Problem uploading converted image file(.dng) into dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-uploading-converted-image-file-dng-into-dropbox/m-p/474099#M24082</link>
      <description>&lt;DIV&gt;Thank you for your solution. I tried this code with changes but this time even the image file is not uploaded to dropbox. Please find my updated code below.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;var namefile= path.basename("C:\\Users\\uploads\\converted\\"+foldername+"\\"+req.file.originalname,".ARW" );

var image =namefile+".dng";
fs.readFile("C:\\Users\\uploads\\converted\\"+foldername+"\\"+image, function(err, data) {
    
    var dbx = new Dropbox({ accessToken: 'XXXX' });
    dbx.filesUpload({path: '/'+link+'/'+image, contents: data})
        .then(function(response) {
        console.log(response);
    })
    .catch(function(error) {
        console.error(error);
    });
});&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I appreciate your help.&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 28 Nov 2020 08:15:10 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-uploading-converted-image-file-dng-into-dropbox/m-p/474099#M24082</guid>
      <dc:creator>JagsDew</dc:creator>
      <dc:date>2020-11-28T08:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem uploading converted image file(.dng) into dropbox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-uploading-converted-image-file-dng-into-dropbox/m-p/474602#M24093</link>
      <description>&lt;P&gt;Have you checked what the value of your 'data' variable is? Does it contain the expected file contents?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I notice you aren't checking the 'err' variable for the&amp;nbsp;readFile call, so you may not be catching any errors that are occurring when reading the file. You should update your code to check that.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 17:55:40 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-uploading-converted-image-file-dng-into-dropbox/m-p/474602#M24093</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-11-30T17:55:40Z</dc:date>
    </item>
  </channel>
</rss>

