We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
Beatso
5 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 Staff
Attempting 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
5 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-DB5 years agoDropbox Staff
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.
- Beatso5 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-DB5 years agoDropbox Staff
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 K4 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.
5,878 PostsLatest Activity: 5 hours agoIf 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!