关于这个......问题但是.........还在学习:3 所以我有一个PHP文件让我们说叫x.php和所有工作我想添加上传者所以人们可以上传txt文件.......但我不想有另一个文件是uploader.php Thnx提前......
<html>
<head>
<title>File Upload Form</title>
</head>
<body>
<center>
upload ur CV.<br>
<form action="same.php" method="post"><br>
<input type="file" name="uploadFile">
<input type="submit" value="Upload Wordlist">
</form>
</body>
</html>
</center>
<?php
move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'],
"../uploads/{$_FILES['uploadFile'] ['name']}")
?>
答案 0 :(得分:0)
您的表单中缺少"enctype="multipart/form-data"
<form action="same.php" method="post">
应该如下所示
<form action="same.php" method="post "enctype="multipart/form-data">
这是上传文件的 必要 部分。
参考手册:
另外,请确保该文件夹是可写的并且设置了适当的权限。
修改强>
<html>
<head>
<title>File Upload Form</title>
</head>
<body>
<center>
upload ur CV.<br>
<form action="" method="post" enctype="multipart/form-data"><br>
<input type="file" name="uploadFile">
<input type="submit" name = "submit" value="Upload Wordlist">
</form>
</body>
</html>
</center>
<?php
if(isset($_POST['submit'])){
move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'],
"../uploads/{$_FILES['uploadFile'] ['name']}");
}
?>