Forum Discussion

A.L's avatar
A.L
New member | Level 1
11 years ago

Drop-in Saver

Hey guys,

I'm struggling to implement a single drop-in saver button on a blank html document running from local host.
I tried copying the dropins.js and referencing it locally but am unsure what else I could try to get a single upload button working.

my code for reference:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title> Saver</title>
    </head>
    <body>
        <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="kyljf8vcbai3kc7">

        <a href="https://dl.dropboxusercontent.com/s/deroi5nwm6u7gdf/advice.png" class="dropbox-saver"></a>

        Dropbox.createSaveButton(localhost, filename);
        </script>
    </body>
</html>

1 Reply

Replies have been turned off for this discussion
  • Lots of things about that code look weird. Try this instead:

    <!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="utf-8">
            <title>Saver</title>
            <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="kyljf8vcbai3kc7"></script>
        </head>
        <body>
            <a href="https://dl.dropboxusercontent.com/s/deroi5nwm6u7gdf/advice.png" class="dropbox-saver">Click here to save.</a>
        </body>
    </html>
    

    I changed a few things:

    1. I put the script tag in the head and closed it.
    2. I put some text inside the anchor tag so you could click the link. (I also moved the anchor tag outside of the <script> wrapper so it actually shows up.)
    3. I removed the call to createSaveButton, which referenced two undefined variables (localhost and filename) and didn't do anything with the button anyway.

About Dropbox API Support & Feedback

Node avatar for 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!