Start 2025 on time and up to date! Seamlessly integrate your calendars into Dropbox with these simple steps! 📆
Forum Discussion
h_vohra
5 years agoExplorer | Level 4
Upload files to a specific folder using javascript
I want to upload my files to a specific folder in dropbox, I am using the filesUpload function to upload files. I want that the folder gets created 1st and then the files are stored in that folder. Below is my code.
:slight_smile: If you aren't sure what my advice mean, better keep your way of coding for now.
Would be enough to concatenate file name to the folder path. Transform everything in your code which seems:
dbx.filesUpload({path: '/' + fileName, contents: file})
To something like:
dbx.filesUpload({path: '/' + folderName + '/' + fileName, contents: file})
Seems you just forgot it. :wink:
Hope this helps.
- ЗдравкоLegendary | Level 20
Hi h_vohra,
I'm just curious, Is there any problem outside fact that you put your file on root level, not in just created folder? You don't report any actual issue!
One advice: when you refer to particular place (folder), it's better practice avoid path in text form, use id instead. Just advice, nothing more (id is more stable way).
- h_vohraExplorer | Level 4
Different users will upload files from the form, so I need it to go on different folders to distinguish properly.
Can you please help me how to get the ID, and add it in the path , I tried adding the folder name in path, but it gave error
- ЗдравкоLegendary | Level 20
:slight_smile: If you aren't sure what my advice mean, better keep your way of coding for now.
Would be enough to concatenate file name to the folder path. Transform everything in your code which seems:
dbx.filesUpload({path: '/' + fileName, contents: file})
To something like:
dbx.filesUpload({path: '/' + folderName + '/' + fileName, contents: file})
Seems you just forgot it. :wink:
Hope this helps.
- PeterdcNew member | Level 2Yes
About Discuss Dropbox Developer & API
Make connections with other developers801 PostsLatest Activity: 14 hours ago
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!