I want a user to be able to download image files and text files. The problem is if a user clicks on "Cancel" once the download box appears, I get this error
HTTP/1.1 200 OK Date: Wed, 04 Sep 2002 08:13:27 GMT Server: Apache/1.3.20 (Unix) PHP/4.0.6 X-Powered-By: PHP/4.0.6 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Keep-Alive: timeout=15, max=99 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html
My script looks like the following
<form>
<input type="radio" name="up_share" value="<php echo $id; ?>">
<input type="submit" name="submit" value="download">
</form>
$path = "./text";
if($submit == "download") {
$result = mysql_query("select filename,type from info WHERE id='$up_share'");
$number = mysql_num_rows($result);
if($number) {
$myrow =mysql_fetch_array($result);
$filename = myrow["filename"];
$type = myrow["type"];
$total = $path . "/" . $filename;
header("Content-type: $type");
header("Content-Length: ".filesize($total));
header("Content-Disposition: attachment; filename=$filename");
readfile($total);
}
I've no idea why it displays this. Please help!!
I'd really appreciate your help.
Thankyou