cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hello, i get error after upload 4Gb data with .Net 4.5 UploadSessionAppendV2Async()

Hello, i get error after upload 4Gb data with .Net 4.5 UploadSessionAppendV2Async()

RomanRGS
Explorer | Level 3
Go to solution
Hello, i get error after upload 4Gb data with .Net 4.5 UploadSessionAppendV2Async() in Dropbox.Api.Files.UploadSessionLookupError: incorrect_offset in DropBox.Api.DropBoxRequestHandler.d__d`3.MoveNext(). Example sessionId AAAAAAAAAEDksu9YYAiFbQ Files less than 4Gb uploads whith no problem.
1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution
Thanks! It looks like you're using a sample we originally posted on the forum here. Thanks to your post, we found an issue with it that would cause it to fail for very large files, due to the use of smaller int types. We've posted an updated version that uses bigger types here:

https://stackoverflow.com/documentation/dropbox-api/409/uploading-a-file/1358/uploading-a-file-using...

The use of longs instead of ints lets it support very large offsets.

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution
Can you share the code you're using that reproduces this issue? Thanks in advance!

RomanRGS
Explorer | Level 3
Go to solution

This code get error on method UploadSessionAppendV2Async after 4gb upload.

 

static async Task ChunkUpload(DropboxClient client, String path, FileStream stream, int chunkSize)
{
int numChunks = (int)Math.Ceiling((double)stream.Length / chunkSize);
byte[] buffer = new byte[chunkSize];
string sessionId = "";
for (int idx = 0; idx < numChunks; idx++)
{
int bytesRead = stream.Read(buffer, 0, chunkSize);
using (var memStream = new MemoryStream(buffer, 0, bytesRead))
{
if (idx == 0)
{
var result = await client.Files.UploadSessionStartAsync(false, memStream);
sessionId = result.SessionId;
}
else
{
var cursor = new UploadSessionCursor(sessionId, (ulong)((uint)chunkSize * (uint)idx));
if (idx == numChunks - 1)
{
FileMetadata fileMetadata = await client.Files.UploadSessionFinishAsync(cursor, new CommitInfo(path), memStream);
}
else
{
await client.Files.UploadSessionAppendV2Async(cursor, false, memStream);
}
}
}
}
}

 

Greg-DB
Dropbox Staff
Go to solution
Thanks! It looks like you're using a sample we originally posted on the forum here. Thanks to your post, we found an issue with it that would cause it to fail for very large files, due to the use of smaller int types. We've posted an updated version that uses bigger types here:

https://stackoverflow.com/documentation/dropbox-api/409/uploading-a-file/1358/uploading-a-file-using...

The use of longs instead of ints lets it support very large offsets.

RomanRGS
Explorer | Level 3
Go to solution

works fine, thanks.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    RomanRGS Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?