note 34971 deleted from function.header by sniper

From: Date: Sun, 07 Sep 2003 21:51:52 +0000
Subject: note 34971 deleted from function.header by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-55663@lists.php.net to get a copy of this message
Note Submitter: ian at ian bennett dot net ---- Re the NS7/Mozilla bug which adds a ".php" extension to files attached in PHP: I've found that if you specify the type of the file by using the filetype command, Mozilla (not tested in NS7) will keep the correct filename and not add ".php" to the end. <?php // $file = filename // $path = path to file header("Content-Disposition: attachment; filename=$file"); header("Content-Length: " . filesize($path)); header("Content-Type: " . filetype($path)); readfile("$path"); ?> Tested in IE6 SP2 and Mozilla 1.4. Results are favourable in both browsers.

« previous php.notes (#55663) next »