Wrong cursor after download
| From: | PHP | Date: | Wed, 06 Sep 2000 23:18:39 +0000 |
| Subject: | Wrong cursor after download | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-15609@lists.php.net to get a copy of this message | ||
I have a pair of scripts which enable a visitor to download a file that does
not reside under htdocs. The first simply creates a form with a submit
button:
<?php
printf("<FORM METHOD=\"POST\"
ACTION=\"download.php\"><br>\n");
printf("<INPUT TYPE=\"submit\" VALUE=\"Download\">");
printf("</FORM>");
?>
The 2nd script is the form handler which dumps a pre-determined file to the
browser:
<?php
$FileName=$REMOTE_USER.".zip";
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename=$FileName");
readfile("/www/var/$FileName");
?>
When I click the "download" button, a "File download" dialog is generated as
expected and I am able to save the file. However, upon completing the
download, the cursor type remains as an arrow/hourglass combination.
Why is there an hourglass? Do I have to close the file or something?
Is there a way to jump to a "Download completed sucessfully page" upon
completion?
Is readfile appropriate for this scenerio or should I look into other
functions such as fopen?
Can someone point me to a tutorial that demonstrates this being done
correctly? I'm using Linux-Apache-Php-MySQL.
Thanks!
Kerry Slaughter