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: 

Dropbox Chooser

Dropbox Chooser

ADMIN H.
New member | Level 1


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 3

Greg-DB
Dropbox Staff

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.
New 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-DB
Dropbox Staff

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.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    ADMIN H. New member | Level 1
What do Dropbox user levels mean?