RE: [PHP] outputting a pdf file to IE browser? POST/GET method bug or not?

2002-07-16 Thread joakim . andersson

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;
> }
> ?>
> 
> 
> 
> --
> 
> 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;
> }
> ?>
> 
> 
> 
> --
> 
> 
> 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




Re: [PHP] outputting a pdf file to IE browser? POST/GET method bug or not?

2002-07-16 Thread gilles

nobody?

does any think this could be a bug or something?

i would like to know before submitting this as a bug.

At 19:18 15-7-2002 +0200, gilles wrote:
>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;
>}
>?>
>
>
>
>--
>
>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;
>}
>?>
>
>
>
>--
>
>
>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




RE: [PHP] outputting a pdf file to IE browser? POST/GET method bug or not?

2002-07-15 Thread Matt Schroebel

> From: gilles [mailto:[EMAIL PROTECTED]] 
> 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;
> }
> ?>
> 
> 
> 

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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php