if(isset($_POST['submitted']))
{
//mysql_connect('localhost','root','')or die(mysql_error());
//mysql_select_db('ecommerce');
include_once ('mysql_connect.php');
if(is_uploaded_file($_FILES['image']['tmp_name']))
{
// $image=$_FILES['image']['tmp_name'];
if(move_uploaded_file($_FILES['image']['tmp_name'], "uploads/".$_FILES['image']['name']))
{
if(!empty($_POST['description']))
{
$d=$_POST['description'];
}
else
{
$d=NULL;
}
$query="INSERT INTO uploads(file_name,file_size,file_type,description)VALUES('{$_FILES['image']['name']}',{$_FILES['image']['size']},'{$_FILES['image']['type']}',$d)"
or die(mysql_error());
mysql_query($query);
}
}
}
**数据库连接没有错误。图片也成功保存在文件夹中,但mysql中没有插入数据。请协助..非常感谢您的帮助!