Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Beatso
6 years agoExplorer | Level 4
too_many_requests when uploading multiple files
Hello,
I am using the javascript sdk and using dbx.filesUpload multiple times to upload multiple files, but I am getting too many requests error. How can I upload multiple files without running...
Greg-DB
Dropbox Community Moderator
6 years agoAttempting to upload multiple files at the same time can cause issues like this. Please refer to the Performance Guide for information on how to manage this.
Beatso
6 years agoExplorer | Level 4
Thanks for the reply. Does that mean there is no way to upload multiple (it's only 5, very small files) at once without getting caught by the ratelimit? Would I have to, for example, upload one file every second? If so, how would I do that?
- Greg-DB6 years ago
Dropbox Community Moderator
That's correct, the Dropbox API doesn't offer a way to upload multiple files in one call, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.
That being the case, you will need to loop through your files and call filesUpload once per file, but only call filesUpload for the next file once the previous file upload has completed, that is, once the callback method has fired.
- Beatso6 years agoExplorer | Level 4
Thanks so much for your help. How would I go about only uploading one file after the callback has completed? This is my code:
function uploadFiles ( storageFilePaths, packFilePaths, packRoot ) { for (i in storageFilePaths) { dbx.filesUpload({ path: packRoot+packFilePaths[i], contents: fs.readFileSync(storageFilePaths[i]) }) .then(function (response) { console.log(response); }) .catch(function (err) { console.log(err); }); } }- Greg-DB6 years ago
Dropbox Community Moderator
There are a number of ways you could structure your code, but one way, much like your earlier thread, is to trigger the next operation from the previous callback method. Alternatively, you may want to look into the use of 'async' and 'await' in JavaScript.
- Siva K5 years agoNew member | Level 2
Has the feature request mentioned here rolled out in current version? Can you kindly confirm I have a situation like I have to upload multiple files ?
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!