我有以下代碼。所有的值都被插入數據庫,而不是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