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 : )

    echo "trash"; 

    I would guess this is generating output...

      yea i figured out you cannot use echo before header function.

      when i use td><?php echo "<img src=\"view.php?file={$row["id"]}\">";?></td>

      i have global turned offf so when it goes to view.php
      file = $row['id'] .... file is not being passed how do i get around this?

        Put this in the top of view.php:

        $file=$_GET['file'];

          GIF89a眰\0í¾¿í¿œ0\0\0í¼³í°œ0\0í¼³í°œ0\0í»€í°€\0í¾¿í¿œ0í¾¿í¿œ0í»¡í¼°í½¾í¿€í²»í¼„Â¼Â‚Ä¾Â¿É‰Â¼íº¬í´‚Â¼Í‰í·í´¾Ä«í¹¸í´ŽË¹Ì—7É·Ü³Ü¼í¸°íµD- ,á¼Î¯Â4Î´Ô¾í±Œí¼„ä°Eò‡–±ÜD8ɉ,ÎŽñŒ¨³ÎÂ…՘풏,Ñí°í±ŒÂƒñŠ…¤%[㝫žœF½º- ³;9Eƃ4Þ³ ǼІz ‘IÆ‚+)F“’$禬ʌӂ}(ӏ<–”™šHN폄;942ὔ¼¹EÞŒx*Ƀ係۾XŒܡW¡ #ꝼ͇䓕 9<6š™ьy´Ƅぬ4ΊۆC\ޤׄÂK󗙦£Ÿ„q.ä…›T¾¿ރuÔ‚Z݄—߾xí¸Ží¼¶4&×¥\"¦¥eݥ쁦FΊ솑䁟[¹».®삙9}í°ŠíºœÂ¾ÂÆë‘3íºŒí¿Î‹Ó†Â™Â³ÂŸ\ß›EBwdžԻԄҀ’܃]Hȃ ¢—O󒯄Sî–$¾¼z¿¿£¦<ó¼–ÂŠí°‰í¼˜ÂÂ+ TºL³¢QŸ™i—™ъŸzܾ䋒Η´VÔŠ\ؼ°jɋܹñƒ¶¤ ÂŒP¨¦$ª¨Œo) ÂªÂ©Öí°…í²Œ3ZÄž4ԋ†C,dÂ_f;

          this is what spits out when i echo the blob data but for some reason when I execute this code

          // Output the MIME header header
          ("Content-Type:{$data["mimeType"]}");
          // Output the image
          echo $data["fileContents"];

          it just doesnt load... im just not sure how to figure this problem out . Does this look familiar with a gif binary data thank s

            Write a Reply...