我收到以下錯誤:錯誤與PHP代碼(文件上傳)
注意:未定義指數:theimage在C:\ WAMP \ www_upload \的index.php上線5
注意:未定義指數:theimage在C:\ WAMP \ www_upload \的index.php上線7
下面是代碼:
<?php
$target_path = "images/";
$target_path = $target_path . basename($_FILES['theimage']['name']);
if(move_uploaded_file($_FILES['theimage']['tmp_name'], $target_path)) {
echo "<p>The image ". basename($_FILES['theimage']['name']). " has been uploaded</p>";
} else{
echo "<p>There was an error uploading the image, please try again!</p>";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="" content="">
</head>
<body>
<form enctype="multipart/form-data" action="index.php" method="POST">
<fieldset>
<input name="theimage" type="file" />
<input type="submit" value="Upload" />
</fieldset>
</form>
</body>
</html>
關於如何解決此問題,請任何想法?
'print_r($ _ FILES)'給你什麼? –
您可以發佈'$ _FILES'數組的var_dump或'print_r'嗎?另外,這三個php設置的值是什麼? 'file_uploads','upload_max_filesize','max_file_uploads' – Jeff