Dropbox Direct Download Link
Sometimes I want to share a large file on my site without tying up bandwidth. If I don’t intend for the file to be downloaded often, I can offload the work to Dropbox and use PHP or htaccess to share a convenient URL.
https://yoursite.com/project/psdfile/index.php
1 2 3 4 5 | <?php $file_url = 'https://dl.dropboxusercontent.com/s/05tgracr475xvke/some_large_psd_file.zip' // Redirect the request to DropBox header( 'Location: ' . $file_url); |
https://yoursite.com/project/psdfile.psd
1 2 3 4 | RewriteEngine On RewriteBase / RewriteRule ^project/psdfile\.psd "https://dl.dropboxusercontent.com/s/05tgracr475xvke/some_large_psd_file.zip" [R=302,L] |
You can get the direct download link for a Dropbox file like so
1) Sign in and upload a file
Here I will share a hard-to-find firmware file for a Japanese Buffalo WZR-HP-G450H router to make it accept US firmware (and not be intentionally crippled anymore!). Now I can use wget
to retrieve it.
2) Share the file
Hover or right click on the link and click “share”.
3) Create a share link
Click on “Create a link” and then copy the new link.
4) Modify the URL
Change www.dropbox.com
to dl.dropboxusercontent.com
, and remove the trailing ?dl=0
.