Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
dalal_subhranil
8 years agoExplorer | Level 4
Copy file to local drive
How I can copy a file from user's dropbox account to servre using JS SDK. Previously we were using PHP SDK where user giving permission access app folder to our app. Then app was reading all files fr...
Greg-DB
Dropbox Community Moderator
8 years agoIf you want to download a file from Dropbox using the API v2 JavaScript SDK, you should use the filesDownload method:
https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesDownload__anchor
There's an example of using sharingGetSharedLinkFile, which works similarly to filesDownload, here:
https://github.com/dropbox/dropbox-sdk-js/blob/master/examples/javascript/download/index.html
For filesDownload, you would provide a file path instead of the URL.
In any case, note that JavaScript running in the browser doesn't have access to the local filesystem in general. The fileDownload method will give you the file data, but what you do with it from there is up to you. For example, the sharingGetSharedLinkFile method linked above allows the user to click a button to download it.
https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesDownload__anchor
There's an example of using sharingGetSharedLinkFile, which works similarly to filesDownload, here:
https://github.com/dropbox/dropbox-sdk-js/blob/master/examples/javascript/download/index.html
For filesDownload, you would provide a file path instead of the URL.
In any case, note that JavaScript running in the browser doesn't have access to the local filesystem in general. The fileDownload method will give you the file data, but what you do with it from there is up to you. For example, the sharingGetSharedLinkFile method linked above allows the user to click a button to download it.
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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!