2017-01-31 91 views
0

我在更改我的代码之前已经提出了这个问题,而且我的图片上传根本无法正常工作我已经检查过用户名密码,而且它们都是正确的。我的代码不会显示任何错误我不知道该怎么办了有人可以帮我吗?我出于安全原因更改了连接php图片上传不起作用

<?php 

$con = mysqli_connect("localhost", "torcdesi_jone45", "password", "torcdesi_amazing"); 
if (mysqli_connect_errno()) { 
    echo "Failed to connect to MySQL: " . mysqli_connect_error(); 
} 

$query_image = 'INSERT INTO shirt_table (images3) 
       values("' . $_FILES['file3']['name'] . '")'; 
?> 
<?php 

include("configur.php"); 
if($_POST) { 
    // $_FILES["file"]["error"] is HTTP File Upload variables $_FILES["file"] "file" is the name of input field you have in form tag. 

    if ($_FILES["file3"]["error"] > 0) { 
     // if there is error in file uploading 
     echo "Return Code: " . $_FILES["file3"]["error"] . "<br />"; 
    } else { 
     // check if file already exit in "images" folder. 
     if (file_exists("shirtimgs/" . $_FILES["file3"]["name"])) { 
     } else { 
      //move_uploaded_file function will upload your image. 
      if(move_uploaded_file($_FILES["file3"]["tmp_name"],"shirtimgs/" . $_FILES["file3"]["name"])) 
      { 
       // If file has uploaded successfully, store its name in data base 
       $query_image = "insert into shirt_table"; 

       if(mysqli_query($link, $query_image)) { 
        echo "Stored in: " . "shirtimgs/" . $_FILES["file3"]["name"]; 
       } else { 
        echo''; 
       } 
      } 
     } 
    } 
} 
?> 
+0

检查错误,然后 –

+0

* “我已经问过这个问题之前,” * - 你的意思是这一个? http://stackoverflow.com/questions/41950688/image-name-will-not-upload-to-database - 如果是这样,它构成了一个转发。 –

+0

我知道缺少什么,而且非常简单,真正的错误报告和阅读手册可以帮助您。 –

回答