On Tue, 19 Mar 2002, Ian Wayne wrote: > I'm trying to use some header functions to force the browser to download > quicktime movies. I have a small piece of code that takes the relevant file > name from the url and then uses that in the header function. This code sits > in get.php. Unfortunately, all I download when I click the link is get.php. > Although the name is changed to the desired file name (eg 193430239.mov).
Let me know if this link works for you (works for me in both IE and lynx): http://u.nu/test/download-intro.html Here's the code I used (stolen liberally from yours): <? // clean up file name $file = preg_replace( array('/^\//', '/\.\.+/', '/[^a-zA-Z0-9\.\-_ ]/', '/\.php\b/'), '', $PATH_INFO); if (is_readable($file)) { header("Content-type: application/octet-stream\n"); header("Content-disposition: attachment; filename=\"$file\"\n"); header("Content-transfer-encoding: binary\n"); header("Content-length: ".filesize($file)."\n"); readfile($file); } ?> miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php