This script is followed from a previous script, which contains the $id varaible, which is also the correct file name of various txt files which are stored in files/name.txt, so I'm trying to allow users to download these files, instead of the browser displaying them.
Can anyone tell me why this script don't work? I've tired different variations. The script doesn't show any errors, simply a blank page.
<?php
$id = $_GET['id'];
$filename="$id.txt";
// the name the file will have on client computer
// the name the file has on the server (or an FTP or HTTP request)
$user_agent = strtolower ($_SERVER["HTTP_USER_AGENT"]);
header( "Content-type: application/force-download" );
if ((is_integer (strpos($user_agent, "msie"))) && (is_integer (strpos($user_agent, "win")))) {
header( "Content-Disposition: filename=".$filename);
} else {
header( "Content-Disposition: attachment; filename=".$filename);
}
header( "Content-Description: File Transfert");
@readfile(files/$id.txt);
?>
Thanks for any help.
-- Derrick