-1

Regarding this ...... question but......... still learning :3 so i have a php file lets say called x.php and all working i would like to add uploader so people can upload txt files ....... but i dnt want to have another file which is uploader.php Thnx in advance......

<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']}")
?> 

1 Answers1

0

Your form lacks "enctype="multipart/form-data" in
<form action="same.php" method="post"> which should read like this
<form action="same.php" method="post "enctype="multipart/form-data">

This is an essential part of uploading files.

Consult the manuals:

Plus, make sure that the folder is writeable and with proper permissions set.


Edit:

<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']}");
    }
?>
Funk Forty Niner
  • 74,372
  • 15
  • 66
  • 132