Hadline

Free learning Computer repairing, Free Download Latest antivirus, Free Download New Games, Free Download latest Mobile softwares, Free download Mozila,New Seo softwares and much more.

How to make a download link






To make a download link , just put a hyper link to a an other page contains download headers.
I explain it by an example:

Put a hyper link to download page:

Code:

<a href="music2_download.php">download</a></font></b></p>

If user clicks on this link , he is redirected to  "music2_download.php" page. Put the following codes in "music2_download.php" file.

code:


<?php
include "auth.inc"; // This code insure that just registered users can download our file
?>
<?php
$FileName = "/music2.swf";  // the name of the file that is downloaded
$FilePath = "my_music";  // the folder of the file that is downloaded , you can put the file in a folder on the server just for more order


$size = filesize($FilePath . $FileName) ;
header("Content-Type: application/force-download; name=\"". $FileName ."\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ". $size ."");
header("Content-Disposition: attachment; filename=\"". $FileName ."\"");
header("Expires: 0");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo (readfile($FilePath . $FileName));
?>



------------------------------------------------------------------------------------------

The following is an extra part for this post :

You may want to use just one "download.php" page for all of your downloads. You can send the file name through a hidden variable , The form below allows to send the file name to "download.php" page :


code:




<FORM ACTION="download.php" METHOD=POST>




<INPUT TYPE="hidden" NAME="music_name"    VALUE= "music1.swf"  >




<BR>
To download music1: 
<INPUT TYPE="SUBMIT" NAME="download_music1"  VALUE=" download_music1 ">




</FORM>




<FORM ACTION="download.php" METHOD=POST>




<INPUT TYPE="hidden" NAME="music_name"    VALUE= "music2.swf"  >




<BR>
To download music2:  
<INPUT TYPE="SUBMIT" NAME="download_music2"  VALUE=" download_music2">




</FORM>




0 comments:

Post a Comment

Post Comments

chitika

Videos Traning

extremetracking

eXTReMe Tracker

LinkWithin

Related Posts Plugin for WordPress, Blogger...

Ads

Join US

Counter

Followers

Blogger news

Flog Counter


Advertisement

Popular Posts

 

Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com