代码无法将图像插入数据库,原因是.它不会越过if语句


The code is not able to insert an image into the database because. it does not go past the if statement

代码无法将图像插入数据库,因为它不会越过if语句。当我运行应用程序时,我总是收到"请插入有效的图像"。我没有任何错误在代码中。请您帮忙,我们将不胜感激。

    <form action="uploadtest.php" method="POST" ectype="multipath/form-data">
        <label>Picture:</label><input type="file" name="image">
        <input type="submit" name="submit" value="Add Record">

  <?php
   mysql_connect("localhost", "root", "");
   mysql_select_db("testlab");
    //file properties
    if(empty($_FILES) || !isset($_FILES['image']))
    {   
    echo "Please Insert a valid image";
    }//end of if statement
    else
    {   
       $image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
       $image_name = addslashes($_FILES['image']['name']);
       $image_size = getimagesize($_FILES['image']['tmp_name']);
          if($image_size==FALSE)
         echo "This is not an image.";
          else
         {
        mysql_query("INSERT into testimage VALUES('','$image_name','$image'");
        echo "Image Successfully inserted into the Database";
         }
    }//end of else statement
?>

您的HTML中有一个拼写错误,应该是enctype="multipart/form-data",而不是"ecttype"answers"multipath"。

ectype="..."更改为enctype="..."(缺少'n'(。