Home arrow PHP arrow Page 2 - Optimize File Downloading in PHP

Implementing PHP Download Optimization Script - PHP

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.

TABLE OF CONTENTS:
  1. Optimize File Downloading in PHP
  2. Implementing PHP Download Optimization Script
By: Codex-M
Rating: starstarstarstarstar / 0
July 06, 2011

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Implementation Steps

If you would like to run the project like what is shown in this demo page: http://www.php-developer.org/phpdownloadsystem :

1.) Download the script here and extract: http://www.php-developer.org/wp-content/uploads/scripts/phpdownloadsystem.zip

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.

9.) Execute in the browser and test, just like in this page: http://www.php-developer.org/phpdownloadsystem.

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.



 
 
>>> More PHP Articles          >>> More By Codex-M
 

blog comments powered by Disqus
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 



© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap

Dev Shed Tutorial Topics: