[PHP] Passing files to a browser

2001-02-08 Thread Rob Root

HI,

I am having problems passing files through to a browser.  First I tried:

?php
$fp = fopen("test.pdf", "r");
header("content-type: application/pdf");
fpassthru($fp);
fclose($fp);
?

And got an Acrobat instance with no file displayed. Then I tried:

?php
$fp = fopen("test.txt", "r");
header("content-type: text/plain");
fpassthru($fp);
fclose($fp);
?

And got:
Hello, World
br
bWarning/b:  1 is not a valid File-Handle resource in
b/home/robr/public_html/php/getpdf.php/b on line b5/bbr

Help!!

rr


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Passing files to a browser

2001-02-08 Thread Christian Reiniger

On Thursday 08 February 2001 18:43, Rob Root wrote:

 ?php
 $fp = fopen("test.txt", "r");
 header("content-type: text/plain");
 fpassthru($fp);
 fclose($fp);
 ?

 And got:
 Hello, World
 br
 bWarning/b:  1 is not a valid File-Handle resource in
 b/home/robr/public_html/php/getpdf.php/b on line b5/bbr

That most likely means the fopen () failed.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

This is JohnC IMHO, I compaired tri-word groupings here and in his plan
and got a good match.

- /. posting discussing the likelihood that an AC post that claimed to be
posted by John Carmack during his honeymoon (and having the login info at
home) was actually from him.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Passing files to a browser

2001-02-08 Thread Javier Muniz

Actually, if you read the manual entry for fpassthru, it states that the
filehandle will be closed by fpassthru upon reading.
So you're trying to close your filehandle twice... get rid of the
fclose($fp) at the end and you should be fine.

-jm

-Original Message-
From: Christian Reiniger [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 08, 2001 11:19 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Passing files to a browser


On Thursday 08 February 2001 18:43, Rob Root wrote:

 ?php
 $fp = fopen("test.txt", "r");
 header("content-type: text/plain");
 fpassthru($fp);
 fclose($fp);
 ?

 And got:
 Hello, World
 br
 bWarning/b:  1 is not a valid File-Handle resource in
 b/home/robr/public_html/php/getpdf.php/b on line b5/bbr

That most likely means the fopen () failed.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

This is JohnC IMHO, I compaired tri-word groupings here and in his plan
and got a good match.

- /. posting discussing the likelihood that an AC post that claimed to
be
posted by John Carmack during his honeymoon (and having the login info
at
home) was actually from him.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Passing files to a browser

2001-02-08 Thread Rob Root

HI,

Getting rid of the fclose makes the error go away with the .txt file, but I
am still getting a blank display with




Javier Muniz wrote:

 Actually, if you read the manual entry for fpassthru, it states that the
 filehandle will be closed by fpassthru upon reading.
 So you're trying to close your filehandle twice... get rid of the
 fclose($fp) at the end and you should be fine.

 -jm

 -Original Message-
 From: Christian Reiniger [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, February 08, 2001 11:19 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Passing files to a browser

 On Thursday 08 February 2001 18:43, Rob Root wrote:

  ?php
  $fp = fopen("test.txt", "r");
  header("content-type: text/plain");
  fpassthru($fp);
  fclose($fp);
  ?
 
  And got:
  Hello, World
  br
  bWarning/b:  1 is not a valid File-Handle resource in
  b/home/robr/public_html/php/getpdf.php/b on line b5/bbr

 That most likely means the fopen () failed.

 --
 Christian Reiniger
 LGDC Webmaster (http://sunsite.dk/lgdc/)

 This is JohnC IMHO, I compaired tri-word groupings here and in his plan
 and got a good match.

 - /. posting discussing the likelihood that an AC post that claimed to
 be
 posted by John Carmack during his honeymoon (and having the login info
 at
 home) was actually from him.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]