note 24770 deleted from function.header by sniper

From: Date: Sun, 07 Sep 2003 21:31:55 +0000
Subject: note 24770 deleted from function.header by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-55611@lists.php.net to get a copy of this message
Note Submitter: j.u-no-rsem-spam-@quicknet.nl ---- Here's one for all the people that really want to force any type of download, if it's text, or a word document, or anything else, this works. [code] $attachment = (strstr($HTTP_USER_AGENT, "MSIE")) ? "" : " attachment"; // IE 5.5 fix. $string = " <html> <head> <title>Hellooo world!</title> </head> <body> <div style='position: absolute; left:200px; top:200px; width: 200px; height:200px; border: 1 solid #ABABAB; font-family:verdana; font-size:10px; font-weight:bold; background-color:#EFEFEF; color: #ABABAB;'> Hi m8, i'm a little file that's just been downloaded to your pc :) </div> </body> </html>"; header("Cache-control: private"); // another fix for IE header("Content-Type: application/octet-stream"); header("Content-Length: ".strlen($string)); header("Content-Disposition: attachment; filename=iamalittlehtmlfile."."html"); echo $string; [/code] you can replace the string by any file you just fpassthru. just make sure that the '.' for the filename is set before the extention that's concatted to it. I know it's weird, but if u don't do it like this, and try to send a word document, it will just open in the browser.

« previous php.notes (#55611) next »