Hi, i have this code. The dl var is getting filled from a link!
what im trying to do is make it pop up the download box, but i need to get application type for it to work, why doesn't it work? All the filetypes could be differnt!
Some could be .ppt files, some could be .php, .doc etc
This does not work!
any ideas on how to do this?
Regards,
Martin
Gaming Help And Info:
what im trying to do is make it pop up the download box, but i need to get application type for it to work, why doesn't it work? All the filetypes could be differnt!
Some could be .ppt files, some could be .php, .doc etc
Code:
<?php
global $f;
$f = $_GET['dl'];
$ext = substr($f,-3);
//echo "Filename: $f :: Extension: $ext";
switch($ext){
case "php": $ct = "application/x-httpd-php"; break;
case "ppt": $ct = "application/vnd.ms-powerpoint"; break;
}
// We'll be outputting a PDF
header('Content-type: "$ct"');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="$f"');
// The PDF source is in original.pdf
readfile('$f');
?>
This does not work!
any ideas on how to do this?
Regards,
Martin
Gaming Help And Info: