-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,450
  • 15
  • 68
  • 141
  • TU !!! GOT IT ? but now when press upload my whole script runs ... and doesnt upload but no errors. – lionTHEWold Aug 19 '14 at 21:28
  • i gave it 777 and tried with 755 – lionTHEWold Aug 19 '14 at 21:30
  • tu for the care i copy pasted it inside my script still doesnt wanna upload :3 – lionTHEWold Aug 19 '14 at 21:36
  • You're doing `../uploads` which translates to, the upload folder is one sub-folder down from where you are executing the code. Do visit http://php.net/manual/en/function.move-uploaded-file.php and read through it. @lionTHEWold there's nothing more than I have already said that could be of help; that's about all there is too it. – Funk Forty Niner Aug 19 '14 at 21:40
  • TU :) even thought u have changed it to / which is dir but anyway tu :) – lionTHEWold Aug 19 '14 at 21:44
  • me again, now my upload and submit button do the same just run the script ? even though they r with diffrent names any indea ? – lionTHEWold Aug 19 '14 at 22:46