Posted by Dave Turner on 07/01/05 19:35
download.php ...
<?
set_time_limit(600); // 600 secs (10 mins) maximum transfer
$fname = $_GET["fname"];
switch(trim(strtolower($fname)))
{
case 'myfile1':
$file = 'private/file1.zip'; break;
case 'myfile2':
$file = 'private/file2.zip'; break;
default:
Location("downloadinvalid.php"); exit;
}
header ("Pragma: no-cache"); // HTTP/1.0
header('Content-Description: File Transfer\n');
header("Content-type: application/octect-stream\n");
header('Content-Length: ' . filesize($file) . "\n");
header('Content-Transfer-Encoding: binary\n');
header('Content-Disposition: attachment; filename=' . basename($file) .
"\n\n");
readfile($file);
?>
usage:
download.php?fname=myfile1
Navigation:
[Reply to this message]
|