PHP Tutorial File download is a database tutorial based on the records and then use the header in PHP to achieve file download.
?
Include './admin/connect.php ';
@extract ($db->get_one ("select * from Movieinfo where id= '. $_get[' id '].");
$db->query ("Update movieinfo set downnum=downnum+1 where id= '". $_get[' id '). "
Control Downloads
$url 2= "./admin/"/The path to the movie
if ($localaddress)
{
$newname = $localaddress;
$movieurl = $url 2 $newname;
}
$type =basename ($movieurl);
$type = substr (STRRCHR ($type, '. '), 0);
$filename = $title. $type;
$file =fopen ($movieurl, ' R ');
Ob_end_clean ();
Header (' Content-type:application/octet-stream ');
Header (' accept-ranges:bytes ');
Header (' Accept-length: ' FileSize ($movieurl));
Header ("content-disposition:attachment; Filename= ". $filename);
Echo fread ($file, FileSize ($movieurl));
Fclose ($file);
Exit;
?>