Backend / DevOps / Architect
Brit by birth,
located worldwide

All content © Alex Shepherd 2008-2024
unless otherwise noted

Drupal 7 Secure File Download Script

Published
0 min read
image
Image Credit: Unknown (if this is your work, reach out to me and I'll credit you!)

This PHP script is designed to be integrated with a Drupal 7 instance, to serve predefined files to authenticated users only. To implement it, just place it somewhere in your DocRoot, then link from a node in your Drupal site to the script, setting the $_GET['file'] value to the required number for each request. It's an extremely simple script, and could be improved a lot, but there doesn't seem to be anything else like it around, so I hope it's of use to someone! Find the code here.

n00b