Using PHP to serve downloadable content is more efficient, secure, and flexible than the traditional direct link method (using a hyperlink). In this programming tutorial you will learn some tips to optimize the file downloading process on your website.
2.) Download testsound.zip here and extract: http://bit.ly/oWzsmL 3.) Upload testsound folder to the root directory of your website. Files are not publicly accessible since it is protected with “Deny from all” .htaccess. 4.) Create a MySQL database table like what is shown here: http://www.php-developer.org/screenshot/phpmyadminscreenshottable.jpg , using phpMyAdmin. Name the table: filedownload 5.) Open index.php and do the following changes:
a.) Change $key to something unique. b.) Assign your own private and public key for recaptcha c.) Change “example.org” domain in $redirect variable to your own domain d.) Save index.php with the above changes.
6.) Open confirmationpage.php and do the following changes:
a.) Change “example.org” domain in $downloadscript variable to your own domain b.) Change “example.org” domain in the hyperlink value at the bottom of the code. c.) Save confirmationpage.php with the changes.
7.) Open downloadfile.php and do the following changes:
a.) Change $pass to be the same value with $key in index.php. b.) Change the value of $downloadpath with the absolute path to the testsound folder (with respect to your root). c.) For $confirmationpage and $origin variable, change the domain from example.org to your own domain name. d.) Assign correct MySQL database credentials ($username, $password, etc) e.) In the mail, change youremail@example.org to your actual email address. Change also the “From”. f.) Save downloadfile.php
8.) Upload phpdownloadsystem with the edited scripts to your website root directory. The phpdownloadsystem folder should contain all the 5 PHP script files on it.
You can test the demo and see how it works. You can use this project in any content types as long as the server is Apache and using PHP 5 and MySQL 5 in Linux/Unix OS.