<?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: UploadAsync - File got corrupt after uplaod - C# in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/UploadAsync-File-got-corrupt-after-uplaod-C/m-p/242313#M13510</link>
    <description>You appear to setting bytBlobdata to an empty array (with a size of the length of the file) and then uploading that, so the resulting file will just be zeros. &lt;BR /&gt;&lt;BR /&gt;You need to supply the actual file data instead. For example, you can just pass in fsBlobData as the body to UploadAsync instead of bytBlobdata.</description>
    <pubDate>Tue, 19 Sep 2017 19:24:32 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2017-09-19T19:24:32Z</dc:date>
    <item>
      <title>UploadAsync - File got corrupt after uplaod - C#</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/UploadAsync-File-got-corrupt-after-uplaod-C/m-p/242196#M13501</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to upload photos to Dropbox account using v2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;FileStream fsBlobData = new FileStream(filePath, FileMode.Open, FileAccess.Read);
byte[] bytBlobdata = new byte[fsBlobData.Length];        
using (var dbx = new DropboxClient(accessToken)) 
{
      using (var stream = new MemoryStream(bytBlobdata))
      {                                  
           var response = await dbx.Files.UploadAsync("/"+ folder + "/" + 
           fileName, WriteMode.Overwrite.Instance, body: stream);                  
           return response;
       }               
}&lt;/PRE&gt;
&lt;P&gt;But after uplaoding when i try to preview file it says "This file can’t be previewed".&lt;/P&gt;
&lt;P&gt;My original file is 129kb and uploaded is 129.19kb.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then i have downloaded the same file from Dropbox itself and try to open with windows image viewer but windows photo viewer can't open this picture.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please tell me what i'm doing wrong here.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:19:15 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/UploadAsync-File-got-corrupt-after-uplaod-C/m-p/242196#M13501</guid>
      <dc:creator>SauravAnand</dc:creator>
      <dc:date>2019-05-29T09:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: UploadAsync - File got corrupt after uplaod - C#</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/UploadAsync-File-got-corrupt-after-uplaod-C/m-p/242313#M13510</link>
      <description>You appear to setting bytBlobdata to an empty array (with a size of the length of the file) and then uploading that, so the resulting file will just be zeros. &lt;BR /&gt;&lt;BR /&gt;You need to supply the actual file data instead. For example, you can just pass in fsBlobData as the body to UploadAsync instead of bytBlobdata.</description>
      <pubDate>Tue, 19 Sep 2017 19:24:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/UploadAsync-File-got-corrupt-after-uplaod-C/m-p/242313#M13510</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-09-19T19:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: UploadAsync - File got corrupt after uplaod - C#</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/UploadAsync-File-got-corrupt-after-uplaod-C/m-p/242369#M13520</link>
      <description>Hi Greg,&lt;BR /&gt;&lt;BR /&gt;Thank you. Your solution worked, i have passed fsBlobData  as body to UploadAsync and file got uploaded correctly.</description>
      <pubDate>Wed, 20 Sep 2017 05:13:53 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/UploadAsync-File-got-corrupt-after-uplaod-C/m-p/242369#M13520</guid>
      <dc:creator>SauravAnand</dc:creator>
      <dc:date>2017-09-20T05:13:53Z</dc:date>
    </item>
  </channel>
</rss>

