Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Kevin L.28
10 years agoNew member | Level 1
Best Practices for Chunked Upload in Node.js
Hello,
I have had a lot of success so far using the HTTP endpoints to make a web app, but when I tried to switch from a regular upload to a chunked upload I've run into all sorts of problems. P...
Steve M.
Dropbox Staff
10 years agoA couple other issues I can spot:
- Your code doesn't appear to ever call /upload_session/finish. You'll need to detect when you've uploaded the entire file and use that endpoint to close out the upload session.
- A while loop can't work here. You need to wait for each call to /upload_session/append_v2 to complete before calling again. Your code kicks off a bunch of concurrent HTTP requests, so I'd expect you to see error responses from the server on at least some of them.
- You should be updating the value of `offset` when /upload_session/append_v2 returns. (This is part of what you'll do as you turn the while loop into a recursive call instead.) Otherwise, all your calls to /upload_session/append_v2 will try to use the same offset, and all but one call (the first one to make it through) will fail.
- You may also need to put a size limit on your calls to `read`. I believe your current code has the potential of reading too much data and exceeding the maximum size allowed by /upload_session/start and /upload_session/append_v2.
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!