我有以下代码。所有的值都被插入数据库,而不是imaage字段。在数据库中它是图像中的“image”字段>代码有什么问题?等待你的回复,谢谢你。在Mysql数据库中上传图像
0) { echo“上传错误”; } else { echo $ _FILES [“image”] [“name”]; move_uploaded_file($ _ FILES [“image”] [“tmp_name”],“images /".$_ FILES [”image“] [”name“]); $ con = mysql_connect(“localhost”,“root”,“319”);如果(!$ con) {012;}('Could not connect:'。mysql_error()); } mysql_select_db(“ju”,$ con);
$sql="INSERT INTO teacher (tchr_name,tchr_degree,tchr_desig,tchr_email,tchr_phone,tchr_interest,image)
VALUES
('$_POST[tchr_name]','$_POST[tchr_degree]','$_POST[tchr_desig]','$_POST[tchr_email]','$_POST[tchr_phone]','$_POST[tchr_interest]','$_FILES[image][name]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
}
//echo "1 record added";
mysql_close($con)
?>
看看另一个答案https://stackoverflow.com/questions/14535717/uploading-and-moving-image-files-on-web-server-image-not-uploaded/47366018#47366018 – antelove