fpassthru and cancel button on browser
| From: | Albert Chin-A-Young | Date: | Fri, 28 Jul 2000 23:24:38 +0000 |
| Subject: | fpassthru and cancel button on browser | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-8883@lists.php.net to get a copy of this message | ||
I have the following:
// send tarball. create list of files then give as argument
// to tar. cannot use popen because we need a pipe for both
// writing and reading.
$tmp = tempnam ($TMPDIR, $login);
$fh = fopen ($tmp, "w");
foreach (array_values ($dl_file) as $file) {
fputs ($fh, "$file\n");
}
fclose ($fh);
header ("Content-type: application/octet-stream");
header ("Content-Disposition: attachment; filename=\"$package.tar\"");
chdir ("$FTP_BASE_DIR/$FTP_DIR");
$ph = popen ("tar --files-from $tmp -cf -", "r");
fpassthru ($ph);
pclose ($ph);
unlink ($tmp);
exit;
With Netscape 4.7, the file is passed and the tar process stops when
the "cancel" button is clicked (though "unlink($tmp)" never seems to
happen). For IE though, the tar process continues to run and the
pointer in IE is the mouse and clock. Furthermore, clicking on any
option on the web page where the download was initiated from does not
work. Is it possible to overcome this?
--
albert chin (china@thewrittenword.com)