We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
evry1falls
6 years agoCollaborator | Level 8
VB .NET FileUpload using ChunkUpload() error lookup_failed/not_found...
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.
Await ChunkUpload("/Backups", "C:/File.png, (Int(ChunkSize)))
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)sessionId = result.SessionIdElse Dim Cursor As UploadSessionCursor = _
New UploadSessionCursor(sessionId, (CLng(chunkSize * idx))) If (idx = numChunks - 1) Then Await DBX.Files.UploadSessionFinishAsync(Cursor, _
New CommitInfo("/Backups" + "/" + "File.png"), memStream) Else Await DBX.Files.UploadSessionAppendV2Async(Cursor, body:=memStream) End If End If End Using Next End Using
While this code works fine with me with less large files
Await DBX.Files.UploadAsync("/Backups" + "/" + "File.png", WriteMode.Overwrite.Instance, True, Nothing, False, Nothing, False, memorystream)
Thank you.
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 recommend adding some more logging and/or stepping through with a debugger to work out what's going on.
For reference, there's an example of using upload sessions here, in C#, not VB, but it should still serve as a good example of the logic needed to run an upload session.
- Greg-DBDropbox Staff
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 recommend adding some more logging and/or stepping through with a debugger to work out what's going on.
For reference, there's an example of using upload sessions here, in C#, not VB, but it should still serve as a good example of the logic needed to run an upload session.
- evry1fallsCollaborator | Level 8
Thank you that really helped a lot, I will also try the other suggestion in the other post of "overwrite"
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!