[PHP] fpassthru failure with mozilla

2004-10-12 Thread [EMAIL PROTECTED]
I'm using fpassthru so users must log in to have access to certain
files. The users are accessing the fpassthru script with an https
connection. The code works fine with IE but sends inline ascii text
with mozilla/firefox. The code looks like this:

$filepath = bla/bla/files/;
$filename = file.zip;
$fullpath = $filepath/$filename;

header( ' Pragma: ');
header( ' Content-Type: application/force-download' );
header( ' Content-Type: application/octet-stream ' );
header( ' Content-length:'.(string)(filesize($fullpath)));
header( ' Cache-Control: private' );
header(  Content-Disposition: attachment; filename='$filename');

$fh = fopen($filepath/$filename, rb);
fpassthru($fh);

Any ideas? Everything I've read says with the content type set to
application, and the disposition set to attachment I should be set,
but it doesnt seem to be the case.

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



[PHP] fpassthru failure with mozilla

2004-10-12 Thread [EMAIL PROTECTED]
I'm using fpassthru so users must log in to have access to certain
files. The users are accessing the fpassthru script with an https
connection. The code works fine with IE but sends inline ascii text
with mozilla/firefox. The code looks like this:

$filepath = bla/bla/files/;
$filename = file.zip;
$fullpath = $filepath/$filename;

header( ' Pragma: ');
header( ' Content-Type: application/force-download' );
header( ' Content-Type: application/octet-stream ' );
header( ' Content-length:'.(string)(filesize($fullpath)));
header( ' Cache-Control: private' );
header(  Content-Disposition: attachment; filename='$filename');

$fh = fopen($filepath/$filename, rb);
fpassthru($fh);

Any ideas? Everything I've read says with the content type set to
application, and the disposition set to attachment I should be set,
but it doesnt seem to be the case.

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



Re: [PHP] fpassthru failure with mozilla

2004-10-12 Thread Matt M.
 $filepath = bla/bla/files/;
 $filename = file.zip;
 $fullpath = $filepath/$filename;
 
 header( ' Pragma: ');
 header( ' Content-Type: application/force-download' );
 header( ' Content-Type: application/octet-stream ' );
 header( ' Content-length:'.(string)(filesize($fullpath)));
 header( ' Cache-Control: private' );
 header(  Content-Disposition: attachment; filename='$filename');
 
 $fh = fopen($filepath/$filename, rb);
 fpassthru($fh);

it looks good to me.  You might want to try: header('Pragma:
no-cache'); instead of header( ' Pragma: ');

Also, install http://livehttpheaders.mozdev.org/ on mozilla.  Will
help with debugging

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



Re: [PHP] fpassthru failure with mozilla

2004-10-12 Thread ApexEleven
Why use fpassthru? I just use readfile, is there a difference?


On Tue, 12 Oct 2004 11:11:54 -0500, Matt M. [EMAIL PROTECTED] wrote:
  $filepath = bla/bla/files/;
  $filename = file.zip;
  $fullpath = $filepath/$filename;
 
  header( ' Pragma: ');
  header( ' Content-Type: application/force-download' );
  header( ' Content-Type: application/octet-stream ' );
  header( ' Content-length:'.(string)(filesize($fullpath)));
  header( ' Cache-Control: private' );
  header(  Content-Disposition: attachment; filename='$filename');
 
  $fh = fopen($filepath/$filename, rb);
  fpassthru($fh);
 
 it looks good to me.  You might want to try: header('Pragma:
 no-cache'); instead of header( ' Pragma: ');
 
 Also, install http://livehttpheaders.mozdev.org/ on mozilla.  Will
 help with debugging
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 

Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
---

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



Re: [PHP] fpassthru failure with mozilla

2004-10-12 Thread Jordi Canals
On Tue, 12 Oct 2004 09:17:30 -0700, ApexEleven [EMAIL PROTECTED] wrote:

 Why use fpassthru? I just use readfile, is there a difference?
 
The main difference is with fpassthru you never show to the user the
exacr location of the file, so must use the script to download it.

In example, you can control hot-links from other sites, php access
control to the file, and so on. Also, you can put the file outside the
apache documents directory, so the file will never be reached in other
way: if you want the file, you have to use the script wich controls
the access to it.

Regards,
Jordi.

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



Re: [PHP] fpassthru failure with mozilla

2004-10-12 Thread Marek Kilimajer
Jordi Canals wrote:
On Tue, 12 Oct 2004 09:17:30 -0700, ApexEleven [EMAIL PROTECTED] wrote:

Why use fpassthru? I just use readfile, is there a difference?
The main difference is with fpassthru you never show to the user the
exacr location of the file, so must use the script to download it.
In example, you can control hot-links from other sites, php access
control to the file, and so on. Also, you can put the file outside the
apache documents directory, so the file will never be reached in other
way: if you want the file, you have to use the script wich controls
the access to it.
I bet Apex11 meant readfile() php function.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] fpassthru failure with mozilla

2004-10-12 Thread Jordi Canals
On Wed, 13 Oct 2004 00:22:40 +0200, Marek Kilimajer [EMAIL PROTECTED] wrote:

Why use fpassthru? I just use readfile, is there a difference?
 
 I bet Apex11 meant readfile() php function.
 
Oh, I see. Sorry for the mistake. In this case, I would like to know
also the diference ;)

Regards,
Jordi

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



Re: [PHP] fpassthru failure with mozilla

2004-10-12 Thread Jason Wong
On Wednesday 13 October 2004 07:17, Jordi Canals wrote:
 On Wed, 13 Oct 2004 00:22:40 +0200, Marek Kilimajer [EMAIL PROTECTED] 
wrote:
 Why use fpassthru? I just use readfile, is there a difference?
 
  I bet Apex11 meant readfile() php function.

 Oh, I see. Sorry for the mistake. In this case, I would like to know
 also the diference ;)

The difference is that readfile() is easier to use and more appropriate in 
this case. RTFM if you want details.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Beware of the Turing Tar-pit in which everything is possible but nothing of 
interest is easy.
*/

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