前台:
后台:
$pic_data = $_FILES["myFile"]["tmp_name"];
$pic_size = $_FILES["myFile"]["size"];
$filepic = addslashes(fread(fopen($pic_data, "rb"), $pic_size ));
后面再加上插入数据库的语句就可以了,如:"insert into pic(id,picture) values(1,$filepic)"
显示图片:
header("Content-type:image/jpeg");
连接数据库
$result=mysql_query("select * from pic where id=1");
$myrow=mysql_fetch_array($result);
echo ($myrow["picture"]);