Cut the Clutter: Test Ignore Files Feature - sign up to become a beta tester here!
Forum Discussion
AlexBrajkovic
9 years agoExplorer | Level 4
Correct way of uploading files in session?
Somethimes i get error too many write operations when uploading multiple small files at once.
So I decided to upload them in session. But I can't seem to find the correct example of uploading.
In documentation it says UploadSessionStartArg.close or UploadSessionAppendArg.close needs to be true for the last upload_session/start or upload_session/append_v2 call.
But in this example close parameter is always true https://github.com/dropbox/dropbox-sdk-js/issues/80#issuecomment-283189888
And there is no usage of sessionAppend.
So my question is should I use uploadSessionStart for every new file I am uploading, like in example above?
1 Reply
- Greg-DB9 years ago
Dropbox Community Moderator
Yes, you'll need to call uploadSessionStart once for every file you want to upload.
If you need to upload multiple files, you can use uploadSessionFinishBatch to commit them together, but whether or not you use the batch version, you'll need to call uploadSessionStart once per file. (For reference, using uploadSessionFinishBatch is recommended when uploading multiple files at once.)
Also, note that in my basic example in that GitHub issue, I was just uploading small pieces of data as an example, so I could "close" each session in uploadSessionStart, and didn't need to call filesUploadSessionAppendv2 at all. In a real implementation, you would call filesUploadSessionAppendv2 when necessary to upload more data (e.g., when the file is larger) and only "close" it on the last filesUploadSessionAppendv2 call for each file.
There's a data ingress guide here that should be helpful:
https://www.dropbox.com/developers/reference/data-ingress-guide
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,037 PostsLatest Activity: 16 hours ago
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 or Facebook.
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!