cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Uploading to Specific Folder in Dropbox or Creates It

Uploading to Specific Folder in Dropbox or Creates It

CylindoDev
New member | Level 2

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:

  1. Can you specify an upload folder when using the filesUploadSession API?
  2. Can you create folders on the fly or in this workflow?
  3. 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 1

Greg-DB
Dropbox Staff

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.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?