We’re Still Here to Help (Even Over the Holidays!) - find out more 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...
Beatso
6 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-DB
Dropbox Community Moderator
6 years agoThere 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.
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!