Saving files directly to Dropbox from Sitelok
You can allow users to download files using the siteloklink() function directly to their Dropbox. This can be quite useful especially for mobile users. You can read more about Dropbox Saver buttons at
https://www.dropbox.com/developers/dropins/saver
First of all you need to create a simple App in your Drop box account as follows.
1) Login to the Dropbox developer area at
https://www.dropbox.com/developers
2) Click
App Console in the left hand menu.
3) Click the
Create App button.
4) Check the
Drop-ins app option
5) Enter a name for the app. Anything is ok but it needs to be unique. For example Dropbox Save for mysite.com
6) Add your domain name to the app (mysite.com). The Save to Dropbox works only from the domain(s) you add.
7) Finally make a note of the App API key which you will need later.
Now that you have your Dropbox App created we can easily convert download links to be Save to Dropbox buttons.
1) On your page that contains the links add this line to the HEAD section replacing API KEY with your API key
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="API KEY"></script>
2) To convert a download link to use Dropbox we just add data-filename="filename.zip" to the <a> tag of the link replacing filename.zip with the appropriate filename.
For example if you have
<a href="<?php siteloklink('test.zip',1)?>">test.zip</a>
you can change it to use Dropbox like this
<a href="<?php siteloklink('test.zip',1)?>" data-filename="test.zip" >test.zip</a>
This link will now appear as a Dropbox save button on the page allowing the user to save directly to their Dropbox account. This works with files stored directly on your server and also those stored on Amazon S3.