|
我用mysql+php 做了个很简单的上传图片的例子。上传的图片已经存储在mysql中,可是浏览器却不能显示出来。想问一下各位,可能是哪里出了问题?
create table picture (id int(4) not null auto_increment primary key,
description char(50),
bin_data longblob,
filename char(50),
filesize char(50),
filetype char(50));
//show.php
<?php
if($id)
{
mysql_connect("localhost","root","8888");
mysql_select_db("example");
$query="select bin_data,filetype from picture where id=$id";
$result=mysql_query($query);
$data=mysql_result($result,0,"bin_data");
$type=mysql_result($result,0,"filetype");
header("Content-typetype");
echo $data;
}
?>
//show.html
<html>
<body>
<IMG SRC="show.php?id=2">
</body>
</html> |
|