Re: Fw: [PHP] outputting a pdf file to IE browser? POST/GET method bug or not?
| From: | gilles | Date: | Tue, 16 Jul 2002 13:30:56 +0000 |
| Subject: | Re: Fw: [PHP] outputting a pdf file to IE browser? POST/GET method bug or not? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-107860@lists.php.net to get a copy of this message | ||
hi,
well just to make sure, i also ran this test under linux/apache and win2000/apache testing with IE6 and the same error occurs.
it also doesnt matter if i use sessions,
so, the following doesnt work either with POST, but it does work with GET:
-----------------------------
<?
error_reporting(E_ALL);
if(isset($_POST["download"])){
$file_name=$_POST["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>
---------------------
i also opened a brand new browser window and delete all the cache stuff.
i still find it strange that this only occurs when using the post method and not with the get method, while using appart from that, exactly the same code.
At 07:05 16-7-2002 -0400, Matt wrote:
I tried this yesterday on my freebsd box with php 4.2.1 and it worked fine for me in IE6 on Win 2k. I don't see anything wrong in your headers. I wasn't certain that they way you were mixing the use of $_SESSION['download'] and $_POST['download'] is really what you intended to do. As I said below, I'd echo out (or use a sniffer to see) the header statements on the offending page, and make sure you have a length, and the location header has a value. Since you only set the $_SESSION['download'] once, you could have been a victim of previous testing. ----- Original Message ----- From: "Matt Schroebel" <MSchroebel@hsus.org> To: "'gilles'" <phplist@clixicon.nl>; <php-general@lists.php.net> Sent: Monday, July 15, 2002 4:26 PM Subject: RE: [PHP] outputting a pdf file to IE browser? POST/GET method bug or not?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'])) {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@$_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>