Thread: Download portal
View Single Post
Old 07-04-2004, 12:01 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,544
sde is on a distinguished road
place your files below the web root. then use this function to basically force feed the files with the passthru function.
PHP Code:
<?
function download($file)
{
  
$filesize filesize($file);
  
  
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
  
header("Cache-Control: post-check=0, pre-check=0"false);
  
header("Pragma: no-cache"); // HTTP/1.0
  
header("Cache-control: private"); 
  
header("Content-Disposition: attachment; filename=$filename");
  
header("Content-Type: application/octet-stream");
  
  
header("Content-Length: $filesize");
  
header("Content-Transfer-Encoding: binary");

  
$fh fopen($file"rb");
  
fpassthru($fh);
}
?>
__________________
Mike

Last edited by sde; 01-02-2007 at 07:23 AM. Reason: added redhead's changes
sde is offline   Reply With Quote