I have a file that users will purchase via paypal, clickbank and paydotcom. I have to host the file\'s download page on my server.
I\'ve placed the file in a directory o
You can use the parent directory shortcut ../
in your $path
or the dirname function like:
$parent_dir = dirname( dirname( __FILE__ ) );
// first dirname is the directory of this file, second goes up one level, etc.
BTW, beware of indicating the path in your URL, one could read other files (like configuration files or ohter private files) by changing it to download.php?download_file=../../private/bank_certificate.pem
. You should use realpath to get the absolute path of the file and compare it to an "authorized for download" file list.