<?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 VB .NET FileUpload using ChunkUpload() error lookup_failed/not_found... in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/VB-NET-FileUpload-using-ChunkUpload-error-lookup-failed-not/m-p/367707#M20804</link>
    <description>&lt;P&gt;I'm trying to use this code to upload a 12mb file in [Backups] folder. I converted this code from Git dotnet C# example to VB .NET code, but I get Error [File_Not_Found], when I debug this code I noticed that sessionID never returned with value either.&lt;/P&gt;&lt;PRE&gt;Await ChunkUpload("/Backups", "C:/File.png, (Int(ChunkSize)))&lt;/PRE&gt;&lt;PRE&gt;Private Async Function ChunkUpload(Ipath As String, chunkSize As Integer) As Task
chunkSize = 4096 * 1024 '4mb
Using stream = New MemoryStream(File.ReadAllBytes(Ipath))
Dim numChunks = Int(Math.Ceiling(stream.Length / chunkSize))
Console.WriteLine("Chunk upload file...")
Dim buffer() As Byte = New Byte(chunkSize) {}
Dim sessionId As String = String.Empty
Dim byteRead = stream.Read(buffer, 0, chunkSize)
For idx As Integer = 0 To numChunks - 1
idx += 1
Console.WriteLine("Start uploading chunk {0}", idx)
byteRead = stream.Read(buffer, 0, chunkSize)
Using memStream = New MemoryStream(buffer, 0, byteRead)
If (idx = 0) Then
Dim result = Await DBX.Files.UploadSessionStartAsync(body:=memStream)
&lt;STRIKE&gt;sessionId = result.SessionId&lt;/STRIKE&gt;Else
Dim Cursor As UploadSessionCursor = _&lt;BR /&gt;New UploadSessionCursor(sessionId, (CLng(chunkSize * idx)))
If (idx = numChunks - 1) Then
Await DBX.Files.UploadSessionFinishAsync(Cursor, _&lt;BR /&gt;New CommitInfo("/Backups" + "/" + "File.png"), memStream)
Else
Await DBX.Files.UploadSessionAppendV2Async(Cursor, body:=memStream)
End If
End If
End Using
Next
End Using&lt;/PRE&gt;&lt;P&gt;While this code works fine with me with less large files&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Await DBX.Files.UploadAsync("/Backups" + "/" + "File.png",
                                                  WriteMode.Overwrite.Instance, True, Nothing, False, Nothing, False, memorystream)&lt;/PRE&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Sep 2019 22:51:28 GMT</pubDate>
    <dc:creator>evry1falls</dc:creator>
    <dc:date>2019-09-27T22:51:28Z</dc:date>
    <item>
      <title>VB .NET FileUpload using ChunkUpload() error lookup_failed/not_found...</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/VB-NET-FileUpload-using-ChunkUpload-error-lookup-failed-not/m-p/367707#M20804</link>
      <description>&lt;P&gt;I'm trying to use this code to upload a 12mb file in [Backups] folder. I converted this code from Git dotnet C# example to VB .NET code, but I get Error [File_Not_Found], when I debug this code I noticed that sessionID never returned with value either.&lt;/P&gt;&lt;PRE&gt;Await ChunkUpload("/Backups", "C:/File.png, (Int(ChunkSize)))&lt;/PRE&gt;&lt;PRE&gt;Private Async Function ChunkUpload(Ipath As String, chunkSize As Integer) As Task
chunkSize = 4096 * 1024 '4mb
Using stream = New MemoryStream(File.ReadAllBytes(Ipath))
Dim numChunks = Int(Math.Ceiling(stream.Length / chunkSize))
Console.WriteLine("Chunk upload file...")
Dim buffer() As Byte = New Byte(chunkSize) {}
Dim sessionId As String = String.Empty
Dim byteRead = stream.Read(buffer, 0, chunkSize)
For idx As Integer = 0 To numChunks - 1
idx += 1
Console.WriteLine("Start uploading chunk {0}", idx)
byteRead = stream.Read(buffer, 0, chunkSize)
Using memStream = New MemoryStream(buffer, 0, byteRead)
If (idx = 0) Then
Dim result = Await DBX.Files.UploadSessionStartAsync(body:=memStream)
&lt;STRIKE&gt;sessionId = result.SessionId&lt;/STRIKE&gt;Else
Dim Cursor As UploadSessionCursor = _&lt;BR /&gt;New UploadSessionCursor(sessionId, (CLng(chunkSize * idx)))
If (idx = numChunks - 1) Then
Await DBX.Files.UploadSessionFinishAsync(Cursor, _&lt;BR /&gt;New CommitInfo("/Backups" + "/" + "File.png"), memStream)
Else
Await DBX.Files.UploadSessionAppendV2Async(Cursor, body:=memStream)
End If
End If
End Using
Next
End Using&lt;/PRE&gt;&lt;P&gt;While this code works fine with me with less large files&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Await DBX.Files.UploadAsync("/Backups" + "/" + "File.png",
                                                  WriteMode.Overwrite.Instance, True, Nothing, False, Nothing, False, memorystream)&lt;/PRE&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2019 22:51:28 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/VB-NET-FileUpload-using-ChunkUpload-error-lookup-failed-not/m-p/367707#M20804</guid>
      <dc:creator>evry1falls</dc:creator>
      <dc:date>2019-09-27T22:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: VB .NET FileUpload using ChunkUpload() error lookup_failed/not_found...</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/VB-NET-FileUpload-using-ChunkUpload-error-lookup-failed-not/m-p/368097#M20814</link>
      <description>&lt;P&gt;It looks like the formatting of your code snippet has been lost, but I think the issue is that you're not actually calling 'UploadSessionStartAsync'. You immediately increment 'idx', so 'idx = 0' never returns true. I&amp;nbsp;recommend adding some&amp;nbsp;more logging and/or stepping through with a debugger to work out what's going on.&lt;/P&gt;
&lt;P&gt;For reference, there's an&lt;A href="https://github.com/dropbox/dropbox-sdk-dotnet/blob/master/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs#L437" target="_self"&gt; example of using upload sessions here&lt;/A&gt;, in C#, not VB, but it should still serve as a good example of the logic needed to run an upload session.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 16:10:45 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/VB-NET-FileUpload-using-ChunkUpload-error-lookup-failed-not/m-p/368097#M20814</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-09-30T16:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: VB .NET FileUpload using ChunkUpload() error lookup_failed/not_found...</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/VB-NET-FileUpload-using-ChunkUpload-error-lookup-failed-not/m-p/368377#M20822</link>
      <description>&lt;P&gt;Thank you that really helped a lot, I will also try the other suggestion in the other post of "overwrite"&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 17:46:44 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/VB-NET-FileUpload-using-ChunkUpload-error-lookup-failed-not/m-p/368377#M20822</guid>
      <dc:creator>evry1falls</dc:creator>
      <dc:date>2019-10-01T17:46:44Z</dc:date>
    </item>
  </channel>
</rss>

