此代碼不會打印上傳圖像的臨時名稱,也不會上載任何圖片到我的照片文件夾中。但打印圖像名稱。它正確地工作其他計算機。哪裏有問題?請幫幫我。我使用的PHP版本5.6.20使用PHP的圖像上傳Mysql
<!DOCTYPE html>
<html>
<head>
<title>Image Upload</title>
</head>
<body>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$destination = "Photo/".$_FILES['image']['name'];
$filename = $_FILES['image']['tmp_name'];
echo $destination;
echo "<br/>";
echo $filename;
echo "<br/>";
if (file_exists($destination))
echo "Sorry, file already exists.";
else
move_uploaded_file($filename, $destination);
$name=$_FILES['image']['name'];
$tmp_name=$_FILES['image']['tmp_name'];
echo $tmp_name;
}
?>
<form method="POST" enctype="multipart/form-data">
<table>
<tr>
<td>Choose Image</td>
<td><input type="file" name="image"/> </td>
</tr>
<tr>
<td>Description:</td>
<td><textarea name="Description" rows="4" cols="40"/></textarea></td>
</tr>
<tr>
<td></td>
<td> <input type="submit" name="submit_image" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>
完成,但不幸的是它不工作。 – Ramzan
發生了什麼問題 –
在我的代碼中,我打印上傳的圖像名稱和該圖像的臨時名稱,並將該圖像上傳到文件夾名稱'照片'中。但問題是它只打印此圖像的名稱,但不打印temp_name,並沒有在我的照片文件夾中上傳任何圖像 – Ramzan