view.php
<?php
include 'db.inc';
$file = clean($file, 4);
if (empty($file))
exit;
// Connect to the MySQL DBMS
if (!($connection = @ mysql_pconnect($hostName,
$username,
$password)))
showerror();
if (!mysql_select_db("db_findinglove", $connection))
showerror();
$query = "SELECT mimeType, fileContents FROM files
WHERE id = $file";
// Run the query on the DBMS
if (!($result = @ mysql_query ($query,$connection)))
showerror();
$data = @ mysql_fetch_array($result);
if (!empty($data["fileContents"]))
{
echo "trash";
// Output the MIME header
header("Content-Type: {$data["mimeType"]}");
// Output the image
echo $data["fileContents"];
}
?>
Ok please tell me why its giving me the error "Cannot modify header information - headers already sent "
I have no html at all before the header(). This code is suppose to display an image but it just echo out the binary code. is this because the headers is not working? I called this page using
<td><?php echo "<img src=\"view.php?file={$row["id"]}\">";?></td> from the index.php page page is this right.
ive been working on this for 5 hours and cant figure it out any help would be appreciated thank you : )