-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']}")
?> 
3
  • 1
    enctype="multipart/form-data", it's quite emphasized in the manual. Commented Aug 19, 2014 at 21:19
  • can you calrify pls... tu Commented Aug 19, 2014 at 21:21
  • It means that this <form action="same.php" method="post"> should be this <form action="same.php" method="post "enctype="multipart/form-data"> which is an essential part of uploading files. Commented Aug 19, 2014 at 21:23

1 Answer 1

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']}");
    }
?>
Sign up to request clarification or add additional context in comments.

6 Comments

TU !!! GOT IT ? but now when press upload my whole script runs ... and doesnt upload but no errors.
i gave it 777 and tried with 755
tu for the care i copy pasted it inside my script still doesnt wanna upload :3
You're doing ../uploads which translates to, the upload folder is one sub-folder down from where you are executing the code. Do visit 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.
TU :) even thought u have changed it to / which is dir but anyway tu :)
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.