Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
SoulPuncher
7 years agoExplorer | Level 3
Dropbox API Error on Upload: Incorrect offset
hello, I have written an app with which you can upload all kinds of files into a dropbox folder. I have already spent several hours trying to fix the error on my own, but I can not find a solution...
Rowipard
6 years agoExplorer | Level 3
Thank you,
Just asking, because I could solve it with the code here.
Rowipard
6 years agoExplorer | Level 3
Private Async Function ChunkUpload(Ipath As String, stream As IO.FileStream, chunkSize As Integer) As Task
Dim numChunks As Integer = Int(Math.Ceiling(stream.Length / chunkSize))
Dim buffer() As Byte = New Byte(chunkSize) {}
Dim II As String = DBLocation.Remove(0, DBLocation.LastIndexOf("\") + 1)
''ant
''Dim sessionId As String = String.Empty
''new
Dim sessionId As String = Nothing
Cursor = Cursors.WaitCursor
''For idx As Integer = 0 To chunkSize - 1
''new
For idx As Integer = 0 To numChunks - 1 Step 1
''idx += 1
Dim byteRead = stream.Read(buffer, 0, chunkSize)
''Dim memstream = New IO.MemoryStream(buffer, 0, byteRead)
''new
Dim memstream As MemoryStream = New MemoryStream(buffer, 0, byteRead)
If idx = 0 Then
''Dim result = Await DBX.Files.UploadSessionStartAsync(False, memstream)
''new
Dim result = Await DBX.Files.UploadSessionStartAsync(body:=memstream)
sessionId = result.SessionId
Else
Dim cursor As UploadSessionCursor = New UploadSessionCursor(sessionId, CLng(chunkSize * idx))
If idx = numChunks - 1 Then
''Await DBX.Files.UploadSessionFinishAsync(cursor, New CommitInfo(Ipath), memstream)
Await DBX.Files.UploadSessionFinishAsync(cursor, New CommitInfo(Ipath + "/" + II), memstream)
Else
''Await DBX.Files.UploadSessionAppendV2Async(cursor, False, memstream)
''new
Await DBX.Files.UploadSessionAppendV2Async(cursor, False, body:=memstream)
End If
End If
Next
End Function
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If 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, Facebook or Instagram.
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!