Re: Problem using readfile
| From: | Matias Pelenur | Date: | Wed, 07 Mar 2001 17:15:09 +0000 |
| Subject: | Re: Problem using readfile | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-5862@lists.php.net to get a copy of this message | ||
Well, I tried using different code (from a newer message by Mukul
Sabharwal):
header("Content-length: $size");
header("Content-type: $type");
$fp = fopen($actualfile, 'rb') or print('Could not open file!');
$read = fread($fp, $size) or print('Could not read file');
print($read);
and this seems to work better, that is, files are download correctly.
However, there is a strange behavior, at least with IE5, which I don't know
if it's a bug on IE5 or not... When I click on a file, if I choose "save to
disk" it works fine, but if I choose "Open from current location" it
doesn't work. Anyone have any ideas on this?
--Matias
""Matias Pelenur"" <matiasp-nospam-@email.com> wrote in message
news:983od5$oc8$1@toye.p.sourceforge.net...
> Hi,
> I'm trying to use readfile to send a file to the browser. The code I'm
using
> is:
>
> header("Content-length: $size");
> header("Content-type: $type");
> header("Content-disposition: attachment;filename=$filename");
> readfile($filename);
>
> It works fine for very small files, but for larger files it seems to send
> only the first 600 bytes and then hang... I tried with both IE and
Netscape
> and
> have the same problem.
>
> I'm using Apache 1.3.14 and PHP/4.0.4pl1 on Win2000 (using the PHP module
> for Apache)
>
> Any hints appreciated. Thanks!
> --Matias
>
> If you reply via email, please remove the -nospam- from the address.
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>