Re: Bug ? Script download problem if user abort download
| From: | Gianluca Morello | Date: | Wed, 31 Oct 2001 15:15:58 +0000 |
| Subject: | Re: Bug ? Script download problem if user abort download | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73026@lists.php.net to get a copy of this message | ||
I retry using the following snuppet:
...
while (!connection_aborted() && !feof($fp) )
{
echo fread($fp, 1000);
}
but nothing change.
I try also with connection_status() and ignore_user_abort(false) but nothign
change.
If the user abort the download progress, the php process hang.
"Gianluca Morello" <gianluca.morello@editek.it> ha scritto nel messaggio
news:20011030173721.80106.qmail@pb1.pair.com...
> I have a download script on IIS 5 and Php 4.0.6 as cgi:
>
> $filename=PDF_PATH.$codfile.".pdf";
> $fp=fopen($filename,"rb");
> if ($fp)
> {
> header("Content-type: application/octet-stream\n" );
> header("Content-transfer-encoding: binary\n");
> header("Content-length: " . filesize($filename) . "\n");
> header("Content-disposition: attachment; filename=".$codfile.".pdf\n");
> $contents="";
> while (!feof($fp))
> {
> $contents .= fread($fp, 1000);
> }
> fclose($fp);
> print($contents);
>
>
> the script works very well.
> But if the user press the Cancel button in the browser download dialog,
the
> current php process stop working. If i try to load a new page another php
> process is spawned, but do nothing.
> If i look in the task manager i see my php processes running (without
doing
> nothing).
> When the timeout occurs the php engine continue wotking correctly.
>
> If i close the browser while php is hang, and i start a new browser
session
> the php pages are correctly processed.
>
>
> I try several other methods :
> readfile,fpassthru,fread($fp,filesize),read and print a small chunks of
> data, but nothing change, when the user abort the download operation the
php
> hang.
>
> This behaviour is very similar to the following bug:
> http://bugs.php.net/?id=8215 , that appears to be closed
>
>
>
>
>
> --
> Gianluca Morello
> Editek S.r.l.
> http://www.editek.it
> Via Vitruvio, 43 - Milano
> Mail: gianluca.morello@editek.it
> Tel. : 02-671166208
> Fax : 02-67493766
>
>