understanding headers

From: Date: Thu, 12 Dec 2002 00:17:58 +0000
Subject: understanding headers
Groups: php.general 
Request: Send a blank email to php-general+get-127933@lists.php.net to get a copy of this message
Hello: I am trying to use the header function to enable users to download files. I am able to get files to download. Unfortunately, the wrong file keeps downloading. Instead of downloading the file I want the php source file is getting downloaded. Here is the posting code: $output = "<a href=\"download.php?name=".$filename."&size=".$size."\">Click here to download ".$filename."</a>"; echo $output; Here is the download code: <?php if ($name) { header("Content-type: application/x-macbinary"); header("Content-length: $size"); header("Content-Disposition: attachment; filename=$name"); header("Content-Description: PHP Generated Data"); echo $data; } ?> Any help anyone might have would be much appreciated. Colin

« previous php.general (#127933) next »