<?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 Upload cuts sometimes the file - corrupted files on DropBox in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-cuts-sometimes-the-file-corrupted-files-on-DropBox/m-p/301891#M18261</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;i have a problem with uploads on Android apps. I use the c# v2 DropBox api. Sometimes the uploaded file are cutted at the end of a chunk (128*1024) on DropBox drive and no error appears in the code.&lt;/P&gt;&lt;P&gt;So at the end there are some corrupted files on DropBox and the Android client has no error state. What can i do?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use this standard code to upload:&lt;/P&gt;&lt;PRE&gt;        private async Task ChunkUploadAsync(String path, FileStream stream, int chunkSize, DropboxClient client)
        {
            ulong numChunks = (ulong)Math.Ceiling((double)stream.Length / chunkSize);
            if (this.bufferUpload == null)
                this.bufferUpload = new byte[chunkSize];
            string sessionId = null;
            for (ulong idx = 0; idx &amp;lt; numChunks; idx++)
            {
                var byteRead = stream.Read(this.bufferUpload, 0, chunkSize);
                using (var memStream = new MemoryStream(this.bufferUpload, 0, byteRead))
                {
                    if (idx == 0)
                    {
                        var result = await client.Files.UploadSessionStartAsync(false, memStream);
                        sessionId = result.SessionId;
                    }
                    else
                    {
                        var cursor = new UploadSessionCursor(sessionId, (ulong)chunkSize * idx);

                        if (idx == numChunks - 1)
                        {
                            FileMetadata fileMetadata = await client.Files.UploadSessionFinishAsync(cursor, new CommitInfo(path), memStream);
                        }
                        else
                        {
                            await client.Files.UploadSessionAppendV2Async(cursor, false, memStream);
                        }
                    }
                }
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:09:58 GMT</pubDate>
    <dc:creator>urs32</dc:creator>
    <dc:date>2019-05-29T09:09:58Z</dc:date>
    <item>
      <title>Upload cuts sometimes the file - corrupted files on DropBox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-cuts-sometimes-the-file-corrupted-files-on-DropBox/m-p/301891#M18261</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;i have a problem with uploads on Android apps. I use the c# v2 DropBox api. Sometimes the uploaded file are cutted at the end of a chunk (128*1024) on DropBox drive and no error appears in the code.&lt;/P&gt;&lt;P&gt;So at the end there are some corrupted files on DropBox and the Android client has no error state. What can i do?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use this standard code to upload:&lt;/P&gt;&lt;PRE&gt;        private async Task ChunkUploadAsync(String path, FileStream stream, int chunkSize, DropboxClient client)
        {
            ulong numChunks = (ulong)Math.Ceiling((double)stream.Length / chunkSize);
            if (this.bufferUpload == null)
                this.bufferUpload = new byte[chunkSize];
            string sessionId = null;
            for (ulong idx = 0; idx &amp;lt; numChunks; idx++)
            {
                var byteRead = stream.Read(this.bufferUpload, 0, chunkSize);
                using (var memStream = new MemoryStream(this.bufferUpload, 0, byteRead))
                {
                    if (idx == 0)
                    {
                        var result = await client.Files.UploadSessionStartAsync(false, memStream);
                        sessionId = result.SessionId;
                    }
                    else
                    {
                        var cursor = new UploadSessionCursor(sessionId, (ulong)chunkSize * idx);

                        if (idx == numChunks - 1)
                        {
                            FileMetadata fileMetadata = await client.Files.UploadSessionFinishAsync(cursor, new CommitInfo(path), memStream);
                        }
                        else
                        {
                            await client.Files.UploadSessionAppendV2Async(cursor, false, memStream);
                        }
                    }
                }
            }
        }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:09:58 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-cuts-sometimes-the-file-corrupted-files-on-DropBox/m-p/301891#M18261</guid>
      <dc:creator>urs32</dc:creator>
      <dc:date>2019-05-29T09:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Upload cuts sometimes the file - corrupted files on DropBox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-cuts-sometimes-the-file-corrupted-files-on-DropBox/m-p/301935#M18271</link>
      <description>&lt;P&gt;I don't see anything obviously wrong here, and since you mention you don't get any error, it sounds like there may be an issue reading from the `FileStream stream` in the first place.&lt;/P&gt;
&lt;P&gt;Can you add some logging to see if you're getting all of the expected data from that stream to begin with?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 16:47:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-cuts-sometimes-the-file-corrupted-files-on-DropBox/m-p/301935#M18271</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-10-08T16:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Upload cuts sometimes the file - corrupted files on DropBox</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-cuts-sometimes-the-file-corrupted-files-on-DropBox/m-p/302850#M18301</link>
      <description>&lt;P&gt;Thank you, i tested with logs and i think its an filestream error.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Oct 2018 14:54:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-cuts-sometimes-the-file-corrupted-files-on-DropBox/m-p/302850#M18301</guid>
      <dc:creator>urs32</dc:creator>
      <dc:date>2018-10-13T14:54:38Z</dc:date>
    </item>
  </channel>
</rss>

