Bruger selv denne til at hente f.eks.
http://users.showsource.dk/install.php?dir=users/includes/submit&file=submit_nybruger.phpfunction download_file($path, $filnavn, $type="") {
if(empty($type)) {
$type= "octet-stream";
}
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")+2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT");
header("Content-Disposition: attachment; filename=". $filnavn ."");
header("Content-Type: application/". $type ."");
header("Content-Length: ".filesize($path) ."");
$fp = @fopen($path,"r");
if($fp) {
print fread( $fp, filesize($path) );
fclose($fp);
}
exit;
}
D.v.s.
$path = fuld sti på harddisken til dir/filnavn
F.eks. /var/www/domain/users/includes/submit/submit_nybruger.php
$filnavn = default navn når brugeren vil gemme
$type = evt. anden type...