Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
DrunkenMoose
5 years agoExplorer | Level 3
Dropbox upload session append - incorrect offset
Hey, I'm working on a dropbox upload function in java (coldfusion). The simpel upload works perfectly, but I'm having troubles with the session upload. Here is what I try to do: >I have an im...
Greg-DB
Dropbox Community Moderator
5 years agoIf the first /2/files/upload_session/append_v2 call is failing with 'incorrect_offset', and indicating a 'correct_offset' of 8024827 for that upload session, then that indicates that the API received that much data for that upload session in the /2/files/upload_session/start call. That is, the 'correct_offset' value indicates how much data the API has received so far for that upload session. If this number is higher than expected, it's likely that your code is accidentally sending more data per call than you intended.
I recommend debugging your code for calling /2/files/upload_session/start to make sure you're only sending as much data as you intended, i.e., "4194304 KB" in this case, from your description. (By the way, did you mean bytes instead of KB? 4 MB = 4194304 bytes, not KB.)
Also, it makes sense that it would work if you use a chunk size of 150 MB for a 20 MB file, since you would be uploading the entire file in the /2/files/upload_session/start call, and so wouldn't need to use /2/files/upload_session/append_v2, so the offset value doesn't need to be checked.
DrunkenMoose
5 years agoExplorer | Level 3
Hey,
First of all, thanks for the quick response! Well that's what I thought! The error indeed states that the first call supposetly sends 8mb data. I made another test example, which is more simple, and I still get the same error. And when I dump the first chunk, it says it's 4mb.. here look at this (I removed unnecessary code):
var max_chunk_size = 4 * 1024 * 1024;
var stuResponse = {}; var httpService = new http(); httpService.setUrl("https://content.dropboxapi.com/2/files/upload_session/start"); httpService.addParam(type="header", name="Dropbox-API-Arg", value="#serializeJSON({ "close" : false })#"); httpService.addParam(type="body", value="#all_chunks[1]#"); var result = httpService.send().getPrefix(); if(structKeyExists(result.ResponseHeader, 'Status_Code') && result.ResponseHeader['Status_Code'] eq '200'){ upload_doc_session = deserializeJSON(result['filecontent'])['session_id']; }
var stuResponse = {}; var httpService = new http(); httpService.setUrl("https://content.dropboxapi.com/2/files/upload_session/append_v2"); httpService.addParam(type="header", name="Dropbox-API-Arg", value="#serializeJSON({ "cursor" : { "session_id" : upload_doc_session, "offset" : max_chunk_size }, "close" : false })#"); httpService.addParam(type="body", value=""); var result = httpService.send().getPrefix(); if(structKeyExists(result.ResponseHeader, 'Status_Code') && result.ResponseHeader['Status_Code'] eq '200'){ } else{ here I get a 409 error that the first call is 8mb big. }
When I dump "all_chunks[1]" it says it's 4mb length. Am I going a little mad here or am I just missing something?
The weird part is that when I do a test with i.e. the string "test" in the first start session, then I correctly get the error
that the last call was 4 bytes long. So I think maybe it's actually 8mb, but the java function len() gives 4mb...
but that would be so weird.
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!