I really think you should read the user comments in the online PHP-manual before doing anything else...
Look here: http://www.php.net/manual/en/function.header.php Regards Joakim Andersson > -----Original Message----- > From: gilles [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 15, 2002 7:19 PM > To: [EMAIL PROTECTED] > Subject: [PHP] outputting a pdf file to IE browser? POST/GET > method bug > or not? > > > hi, > > i've run in to a strange problem, > > i'm trying to output a pdf file from disk to the browser. > > this is fine under netscape but IE has problems. > > consider the following code: > ------------------------------------------- > <? > error_reporting(E_ALL); > > session_start(); > if (!isset($_SESSION['download'])) { > @$_SESSION['download'] = $_GET['download']; > } > > if(isset($_GET["download"])){ > $file_name=$_SESSION['download']; > header("Content-type:application/pdf"); > header("Content-Disposition: inline;filename=\"mypdf.pdf\""); > header("Content-length:".(string)(filesize($file_name))); > header("location: $file_name"); > exit; > } > ?> > <form method=get> > <INPUT TYPE="submit" name=download value="mypdf.pdf"> > </form> > ------------------------------------------ > > the above code runs fine on NS and IE, > IE immediately loads and opens the pdf file inline. > > but this code which only has the difference of using the POST method > instead of the GET metod results in a "file is corrupt" message! > > ------------------------------------------ > <? > error_reporting(E_ALL); > > session_start(); > if (!isset($_SESSION['download'])) { > @$_SESSION['download'] = $_POST['download']; > } > > if(isset($_POST["download"])){ > $file_name=$_SESSION['download']; > header("Content-type:application/pdf"); > header("Content-Disposition: inline;filename=\"mypdf.pdf\""); > header("Content-length:".(string)(filesize($file_name))); > header("location: $file_name"); > exit; > } > ?> > <form method=post> > <INPUT TYPE="submit" name=download value="mypdf.pdf"> > </form> > ------------------------------------------ > > > can anyone explain to me why you can't use the POST method? > is this a bug or is this as expected (i didn't). > > tnx, > > gilles > > i'm running php 4.2.1 on win2000 with IIS5 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php