2014-06-07 16 views
0

我用論壇和使用該行:

<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

檢查$ _FILES不是空的。並使用filter_input來獲取數據。 – vuz3

回答

0

使用加密類型與形式屬性

<form method="post" action="adduser.php" enctype="multipart/form-data"> 
+0

另外我有問題,當我想更新它。在edituser.php – moh3en