RE: [PHP-WIN] Showing a Blob field in a browser
| From: | Dash McElroy | Date: | Fri, 26 Apr 2002 23:26:26 +0000 |
| Subject: | RE: [PHP-WIN] Showing a Blob field in a browser | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-13348@lists.php.net to get a copy of this message | ||
Waldemar,
You need to put the header(); commands before you output any text to the
browser.
<?php
header(header code here);
?>
<!DOCTYPE...>
Otherwise the header commands won't work.
-Dash
p.s. this may not fix your problem, but it will fix the header problem...
-----Original Message-----
From: Waldemar Brand Neto [mailto:wbn@softall.com.br]
Sent: Friday, April 26, 2002 4:24 PM
To: Php
Subject: [PHP-WIN] Showing a Blob field in a browser
Hi, I am a newbie in PHP and Mysql and i´m trying to show a blob field from
a Mysql database in to a browser. Could anyone help me.
Thanks.
The Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Teste.php</title>
</head>
<BODY BGCOLOR=#3366FF>
<CENTER>
<FORM>
<h1> Kompatscher & Cia Ltda </h1>
<hr>
<?php
$con = mysql_connect(*****************) or die ("Erro ao conectar!");
mysql_select_db("**************", $con) or die ("Erro ao selecionar a
database!");
$comando="SELECT
codigo,nome,material,temperatura,pressao,fluido,descricao,foto FROM cadgrupo
WHERE codigo=10";
$res = mysql_query($comando,$con);
$linha = mysql_fetch_array($res);
echo "<TABLE ALIGN=CENTER>";
echo "<tr>";
echo "<td>";
echo "Foto";
echo "</td>";
echo "<td>";
$i= $linha['foto'] ;
$len=strlen($i);
header("Content-type: image/jpeg");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=temp.jpg");
echo "<input type=image src=temp.jpg border=0>";
echo "</td>";
echo "</tr>";
echo "</TABLE>";
mysql_close($con);
?>
</FORM>
</CENTER>
</BODY>
</html>
The anwser of the browse
Kompatscher & Cia Ltda
----------------------------------------------------------------------------
----
Foto
Warning: Cannot add header information - headers already sent by
(output started at C:\Inetpub\wwwroot\Teste.php:11) in
C:\Inetpub\wwwroot\Teste.php on line 25
Warning: Cannot add header information - headers already sent by
(output started at C:\Inetpub\wwwroot\Teste.php:11) in
C:\Inetpub\wwwroot\Teste.php on line 26
Warning: Cannot add header information - headers already sent by
(output started at C:\Inetpub\wwwroot\Teste.php:11) in
C:\Inetpub\wwwroot\Teste.php on line 27