Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
ADMIN H.
10 years agoNew member | Level 1
Dropbox Chooser
Hi everyone,
I'm a bit new to this and am having difficult getting the dropbox chooser to work. Here is what is being inputted into the html:
<!doctype html>
<html>
<head>
<script type="text/javascript"src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="xxxxxx"></script>
</head>
<body>
<div id="container"></div>
<a id="link"></a>
<script>
var button = Dropbox.createChooseButton({
success: function(files) {
var linkTag = document.getElementById('link');
linkTag.href = files[0].link;
linkTag.textContent = files[0].link;
},
linkType: 'preview',
multiselect: true
});
document.getElementById('container').appendChild(button);
</script>
</body>
</html>
Everything works except it is not returning a preview link for one or multiple pictures I have selected. The only thing that happens is a green check mark appears. Would any happen to know how to get the preview links to appear? Thank you for taking the time to respond.
3 Replies
Replies have been turned off for this discussion
- Greg-DB10 years ago
Dropbox Community Moderator
When the user finishes using the Chooser, your success callback method should be called. Is it getting called for you? If so, what does the files variable contain?
In either case, adding something like console.log(files) in the success callback may be a good first step in debugging this.
- ADMIN H.10 years agoNew member | Level 1
Hi Greg,
Thank you for the assistance, it is appreciated.
I tried using the example provided by your dropbox chooser help and used:
success: function(files) {
alert("Here's the file link: " + files[0].link)A pop up appears and appears to display the first link of the chosen picture. However, it does not list the rest and it cannot be copied. I'm attempting to recreate the table provided in your help section when selecting "preview link" and selecting multiple pictures. It outputs all the links as text so that it can be copied if needed be. Thank you again for the help.
- Greg-DB10 years ago
Dropbox Community Moderator
This is different from the code in your first post, but in both cases you're just using the first element in the files array (that is, files[0]).
To access all of the files, iterate through the files array.
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!
Related Content
- 4 years agoanonymous