An HTTP response can only do ONE of these two things: output HTML start a download If you see sites such as SourceForge that *seem* to do this in one page, and analyze their HTML and their headers, you will find that they are using a META refresh tag or some JavaScript to cause the original HTML to re-direct to another URL, which then does the download. So, really, you are visiting the HTML output page, and then in that page, some browser-side hack is forcing the download. I personally find this annoying rather than useful, frankly, but there it is. It obviously works for SourceForge and they have a lot of users, so I must be the exceptional surfer who is annoyed by this. [Just gimme the download link -- don't make me surf to a page to get to the page that gives me the page to get the download. Sheesh!] On Tue, December 12, 2006 3:37 am, viraj wrote: > hi all, > i have a small script which shows some information inside a html table > and then pushes a file to save on to users desktop. > > but with the following code it download the file and stay without > outputting the html table to browser. > > i tried with out put buffering functions, but still no luck (it seems > i'm not clear about those functions yet..). could somebody please help > me on this? > > many thanks > > > ~viraj > > > > <?php > > function my_callback($content) { > header('Content-type: application/binary; > charset=iso-8859-1'); > header("Expires: 0"); > header("Cache-Control: must-revalidate, > post-check=0,pre-check=0"); > header("Pragma: public"); > header("Content-Disposition: attachment; filename=\"Test.url\""); > $content .= "[InternetShortcut]\r\n" . > "URL=http://192.168.1.71/\r\n" . > "IDList=" . > "IconFile=http://192.168.1.71/favicon.ico\r\n" . > "IconIndex=1\r\n" . > "[{000214A0-0000-0000-C000-000000000046}]\r\n" . > "Prop3=19,2\r\n"; > > return $content; > } > > > ob_start('my_callback'); > getBody(); > ob_end_flush(); > > function getBody() > { > ?> > <html> > <head> > <meta http-equiv="Content-Type" content="text/html; > charset=iso-8859-1" /> > </head> > <body> > <table cellspacing="0" cellpadding="0" width="780" align="center" > border="1"> > <tbody> > <tr> > <td class="outerBorder" valign="top" width="780">Some > information goes here..</td> > </tr> > </tbody> > </table> > </body> > </html> > <?php > } > > ?> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php