We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
DavidM27
6 years agoExplorer | Level 4
Download shared file from shared link
Hello,
I'm building a web app using Dropbox API, that app may be use to share some files to people that does not have a dropbox, so I created a share link via the API and then I want those peop...
- 6 years ago
Unfortunately I don't have a good solution to offer here. Using a shared link with the parameter modification is the best way to share read-only access to a file when the recipient doesn't have a Dropbox account. As you found though, these can't be requested programmatically in browser JavaScript due to the CORS policy.
Alternatively, you could have your server do the download first, and then pass the contents down to end-user's browser instead. This would come at the expense of extra server bandwidth consumption though.
dgtal box
2 years agoExplorer | Level 3
How can I make my server download first?
const file = createWriteStream(filePath);
https.get(fileURL, response => {
response.pipe(file);
file.on('finish', () => {
file.close();
resolve();
});
}).on('error', err => {
fs.unlink(filePath, () => reject(err)); // Delete the file asynchronously on error
});
The code works for other content links. but doesn't works for the dropbox link.
I tired dl=1, raw=1. But still it doesn't work.
All i got everytime are invalid files.
Здравко
2 years agoLegendary | Level 20
Hi dgtal box,
It's never good idea using temporary derivative of shared link. The issue here is that... it's temporary - that's why expires. Use either the shared link itself or supported modification only instead. 😉
Hope this helps.
- dgtal box2 years agoExplorer | Level 3
I never used temporary derivative of shared link. I use just the shared link itself.
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!