我使用了论坛并使用了这一行:
<form method="post" action="adduser.php">
Picture:<input type="file" name="file" id="file" accept="image/gif, image/jpeg, image/png" /></br>
<input type="submit" name="submit">
也在adduser.php
$image="pic/" .$_FILES["file"]["name"];
if(mysql_query("INSERT INTO users(userid,username,name,family,email,city,gender,password,img) values(' ','$_POST[username]','$_POST[name]','$_POST[family]','$_POST[email]','$_POST[city]','$_POST[gender]','$password','$image');",$cn))
echo "New user added";
出了什么问题?在数据库表中,我在img中看到: pic /
答案 0 :(得分:0)
使用带表单的enctype属性
<form method="post" action="adduser.php" enctype="multipart/form-data">