I want to upload a text file using html file upload option. By using php I want to put the content of that file into already created text file. But I am unable to do so, I am trying the following code but it only save the file name.
//This is HTML FORM
<form action="project.php" method="post" enctype="multipart/form-data" >
<input type="file" name="file1"><br>
<input type="file" name="file2"><br>
<input type="submit" name="submit" id="submit">
</form>
// THIS is my PHP SCRIPT
if(isset($_POST['submit']))
{
$f1 = $_FILES['file1'];
file_put_contents("a.txt", $f1);
$f2 = $_FILES['file2'];
file_put_contents("b.txt", $f1);
}
$string1=file_get_contents('a.txt');
$string2=file_get_contents('b.txt');
?>
Please help in this regards.
Thanks...