通过php和html表单上载文件的代码错误

通过php和html表单上载文件的代码错误,php,html,mysql,file-upload,Php,Html,Mysql,File Upload,我遇到以下代码错误,导致文件无法上载到服务器。请有人看一下这两个文件,并告诉我哪里弄错了,我知道我可能有点笨,但任何帮助都将不胜感激 这些文件位于一个小型内部intranet上,因此我不关心将数据库连接和密码放入文件的事实 正如我所说的,任何帮助都将不胜感激,因为我只收到最后一个抱歉的错误,没有任何信息被传递到MySQL数据库。我可以得到的形式和代码没有上传,但不能与良好的工作。 我已经检查了上传目录和访问权限,一切正常 html表单: <form enctype="multipart/f

我遇到以下代码错误,导致文件无法上载到服务器。请有人看一下这两个文件,并告诉我哪里弄错了,我知道我可能有点笨,但任何帮助都将不胜感激

这些文件位于一个小型内部intranet上,因此我不关心将数据库连接和密码放入文件的事实

正如我所说的,任何帮助都将不胜感激,因为我只收到最后一个抱歉的错误,没有任何信息被传递到MySQL数据库。我可以得到的形式和代码没有上传,但不能与良好的工作。 我已经检查了上传目录和访问权限,一切正常

html表单:

<form enctype="multipart/form-data" action="add.php" method="POST"> 
Model:<br /> <input type="text" name="model"><br> 
Size:<br /> <input type="text" name="size"><br> 
Total width:<br /> <input type="text" name="tot_width"><br>
Internal width:<br /> <input type="text" name="int_width"><br>
Total height:<br /> <input type="text" name="tot_height"><br>
Frame height:<br /> <input type="text" name="fra_height"><br>
Total depth:<br /> <input type="text" name="tot_depth"><br>
Seat height:<br /> <input type="text" name="sea_height"><br>
Seat depth:<br /> <input type="text" name="sea_depth"><br> 
Arm height:<br /> <input type="text" name="arm_height"><br>
Std leg height:<br /> <input type="text" name="std_leg_height"><br>
Image:<br /> <input type="file" name="image"><br>
<input type="submit" value="Add"> 
</form>
改变


好东西。当你盯着某件东西看了很长时间,直视明显的错误时,总是令人沮丧:)
//This is the directory where images will be saved 
$target = "/images/product"; 
$target = $target . basename( $_FILES['image']['name']); 

//Get all the other information from the form 
$model=$_POST['model'];
$size=$_POST['size'];
$totWidth=$_POST['tot_width'];
$intWidth=$_POST['int_width'];
$totHeight=$_POST['tot_height'];
$fraHeight=$_POST['fra_height'];
$totDepth=$_POST['tot_depth'];  
$seaHeight=$_POST['sea_height'];
$seaDepth=$_POST['sea_depth'];
$armHeight=$_POST['arm_height'];
$stdLegHeight=$_POST['std_leg_height']; 
$pic=($_FILES['image']['name']);

// Connect to Database 
mysql_connect("localhost", "databaseUser", "databasePassword") or die(mysql_error()) ; 
mysql_select_db("databaseName") or die(mysql_error()) ; 

//Write information to the database 
mysql_query("INSERT INTO `prod_dims` VALUES '$model', '$size', '$totWidth', '$intWidth', '$totHeight', '$fraHeight', '$totDepth', '$seaHeight', '$seaDepth', '$armHeight', '$stdLegHeight', '$pic'") ; 

//Put the image on the server 
if(move_uploaded_file($_FILES['image']['name'], $target)) 
{ 

//Is the upload ok 
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and     your information has been added to the directory"; 
} 
else { 

//Give an error if its not 
echo "Sorry, there was a problem uploading your file."; 
}
if(move_uploaded_file($_FILES['image']['name'], $target))
if(move_uploaded_file($_FILES["image"]["tmp_name"], $target))