I have the following code
if(isset($_GET['id']))
{
$id = $_GET['id'];
$query = "SELECT name, type, size, content FROM upload WHERE id = '$id'";
$result = mysql_query($query) or die('Error, query failed');
list($name, $type, $size, $content) = mysql_fetch_array($result);
header("Content-Disposition: attachment; filename=$name");
header("Content-length: $size");
header("Content-type: $type");
echo $content;
exit;
}
The problem I am having is that the header information is being included with the file that is being downloaded. This causes an error for PDF files and leads to extraneous information in other files. I am basing this on a tutorial I found online. Am I missing something? TIA