note 41594 deleted from function.header by kennyt

From: Date: Sun, 18 Jul 2004 18:03:53 +0000
Subject: note 41594 deleted from function.header by kennyt
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-73552@lists.php.net to get a copy of this message
Note Submitter: motion@abv.bg ---- After banging my days for several days on how exactly to force the browser to ask the visitor to save a file rather than opening it, here's my solution. It works perfectly well for everything including .txt files :)) $output_file = 'something.txt'; $content_len = 666; @ob_end_clean(); @ini_set('zlib.output_compression', 'Off'); header('Pragma: public'); header('Content-Transfer-Encoding: none'); header('Content-Type: application/octetstream; name="' . $output_file . '"'); header('Content-Disposition: inline; filename="' . $output_file . '"'); header("Content-length: $content_len"); See it in action at http://www.motion-hosting.com Really works with all file types! So glad I finally did it!

« previous php.notes (#73552) next »