我在這段代碼試過無數的嘗試,我知道HTML是正確的,但是PHP是棘手PHP文件中未將文件放入文件夾
<html>
<body>
<?php
echo "Upload: " . $_FILES["file"]["name"] . "<br>";
echo "Type: " . $_FILES["file"]["type"] . "<br>";
echo "Size: " . ($_FILES["file"]["size"]/1024) . " kB<br>";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
$uploaddir = '/var/www/Megan/';
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
move_uploaded_file($_FILES["file"]["tmp_name"],
$uploadfile);
echo "Stored in: " . "$uploaddir" . $_FILES["file"]["name"];
?>
<h1>File upload successful!</h1>
<form method="get" action="/megan">
<input type="submit" value="Continue"/>
</form>
</body>
</html>
幫我解決這個問題
檢查文件的上傳目錄path.Also添加表單 - 屬性ENCTYPE =「多/表單數據」 –