RE: [PHP] outputting a pdf file to IE browser? POST/GET method bu g or not?
| From: | Matt Schroebel | Date: | Mon, 15 Jul 2002 20:26:10 +0000 |
| Subject: | RE: [PHP] outputting a pdf file to IE browser? POST/GET method bu g or not? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-107753@lists.php.net to get a copy of this message | ||
> From: gilles [mailto:phplist@clixicon.nl]
> Sent: Monday, July 15, 2002 1:19 PM
> Subject: [PHP] outputting a pdf file to IE browser? POST/GET
> method bug or not?
> <?
> 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>
Your code runs fine on my freebsd box running php 4.2.1 and apache. I'd try changing the
header into an echo, and see what you're sending to the browser. Are you meaning to only set
the session var one time? You only set it when it's not set, so if you change the value of
$_POST['download', the session var will still hold the first name.