Jump to content


Header Already sent Problem For Images

  • Please log in to reply
1 reply to this topic

#1 aftabnaveed

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 30 September 2006 - 06:05 AM

Hi, Before listing my problem I would excuse for my English... because i am not a native english speaker
I am trying to read an image from the client side and read the contents of the images through

$picture =  $_FILES["picture"]["tmp_name"];
$fp = fopen($picture,"r");
$content = fread( $fp,filesize($picture) );

Now I am trying to display Image inside a table like


When I try put the header("Content-type:image/jpeg"); line then it says that header already sent error message.

When I try to avoid this i use ob_start() and ob_flush() to display the image, but it only prints the URL from the address bar of the browser. But if I send header("Location:someotherpage.php"); It works well
So Is there any solution for this problem to display the Images header inside the html page

#2 Barand

  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 30 September 2006 - 07:19 AM

Use html img tag
             <img src="<?php echo $_FILES["picture"]["tmp_name"] ?>">

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received


|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users