Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
CylindoDev
6 years agoNew member | Level 2
Uploading to Specific Folder in Dropbox or Creates It
I am trying to make a program that uploads files to folders in a format based on a JSON object. I would like the folder to be created in Dropbox if it doesn't exist and if it does exist then put the file there. Is there a upload parameter that allows for creation of folders or placement depending on availibility.
Main Questions:
- Can you specify an upload folder when using the filesUploadSession API?
- Can you create folders on the fly or in this workflow?
- What is the best way to check what folders exist already?
Any help would be greatly appreciated. I am in the research phase to see if this is even possible.
1 Reply
- Greg-DB6 years ago
Dropbox Community Moderator
1. Yes, when uploading a file, you specify the full path where you want to upload it, including any parent folder(s). It sounds like you're using the JavaScript SDK (but please let me know if not), so for example, you would specify the 'FilesCommitInfo.path' value when calling filesUpload, or if using upload sessions, likewise in the nested 'FilesCommitInfo.path' values when calling filesUploadSessionFinish or filesUploadSessionFinishBatch.
For example, to upload a file named "example.doc" inside a folder named "documents", the path value would look like: "/documents/example.doc".
2. Yes, you can create folders using filesCreateFolder or filesCreateFolderBatch.
3. You can use filesGetMetadata to see if a particular item already exists. Or, you can use filesListFolder/filesListFolderContinue to list the contents of a folder, to see if any particular item(s) exist inside it.
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!