Mega Code Archive

 
Categories / Php / File Directory
 

A simple downloader

download.php ------------ <?php // //The download directory where the files are placed! //A trailing slash is a must! // $dloadsdir = '/files/' //Counter $counter = 'count.txt'; $cf = fopen($counter, "w+"); fputs($cf, "$_GET['file']"); fclose($cf); //Core $file = $_GET['file']; $fp = fopen($file,"rb"); $fsize = filesize($file); header("Content-type: application/download \r \n"); header("Content-length: $fsize \r \n"); fpassthru($fp); fclose($fp); //EOF ?>