<?php  include_once("../conn.php");


$head_pictures=$_FILES['tb_commodity_picture']['size'];
if($head_pictures>2000000){
			echo "<script>alert('您上传的图片超过规定的大小！');history.go(-1);</script>";
			exit();
}
//将图片以二进制格式上传到数据库
$fp=fopen($tb_commodity_picture,"rb");
$head_picture=addslashes(fread($fp,filesize($tb_commodity_picture))); 

$sql="insert into tb_commodity(tb_commodity_name,tb_commodity_address,tb_commodity_counts,tb_commodity_price,tb_commodity_picture,tb_commodity_explain)values('".$_POST[tb_commodity_name]."','".$_POST[tb_commodity_address]."','".$_POST[tb_commodity_counts]."','".$_POST[tb_commodity_price]."','".$head_picture."','".$_POST[tb_commodity_explain]."')";
$query=mysql_query($sql);
if($query==true){
echo "<script>alert('商品提交成功！');history.go(-1);</script>";
}
?>