Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Surya K.
9 years agoNew member | Level 1
Dropbox large file upload
Trying to upload big files with below code.
String upload_id = dbxFiles.uploadSessionStart().finish().getSessionId();
byte[] temp = new byte[CHUNK];
int size = inputStream.available();
int cursor = 0;
while (cursor < size) {
int totalRead = 0;
if ((size - cursor) < CHUNK) {
temp = new byte[size - cursor];
totalRead = inputStream.read(temp, 0, size - cursor);
} else {
totalRead = inputStream.read(temp, 0, CHUNK);
}
dbxFiles.uploadSessionAppend(upload_id, cursor).uploadAndFinish(new ByteArrayInputStream(temp));
cursor += totalRead;
}
uploadFileMetadata = dbxFiles.uploadSessionFinish(new UploadSessionCursor(upload_id, cursor),
new CommitInfo(path, WriteMode.ADD, true, new Date(), false)).uploadAndFinish(inputStream);
But the size of uploaded files are drastically changed. Can you please help me out
5 Replies
Replies have been turned off for this discussion
- Steve M.9 years ago
Dropbox Staff
When you say the size is "drastically changed," could you be more specific? What's the value of "size" and how big is the resulting upload? How big is "CHUNK"?
One quick debugging tip: try printing out the value of "totalRead" and "cursor" before each call to the API. This might help track down the issue.
- Suryakant D.9 years agoNew member | Level 1
For my example 57 MB file uploaded with 4mb chunk become 98mb
- Steve M.9 years ago
Dropbox Staff
Have you tried adding the logging I suggested? What does it reveal?
- Suryakant D.9 years agoNew member | Level 1
Logging I had already added before posting the issue here. Logs were fine. Everything was right. But after upload is finished and when I check the file size in Dropbox that is changed
- Steve M.9 years ago
Dropbox Staff
Could you share the log here (and the updated code that generates that log)?
It's hard to help you debug this without being able to see what's happening.
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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!