How to upload a text file and save the contents in to an existing file
<p>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. </p>

<p>//This is HTML FORM</p>

<pre><code>&lt;form action="project.php" method="post" enctype="multipart/form-data" &gt;
&lt;input type="file" name="file1"&gt;&lt;br&gt;
&lt;input type="file" name="file2"&gt;&lt;br&gt;
&lt;input type="submit" name="submit" id="submit"&gt;
&lt;/form&gt;
</code></pre>

<p>// THIS is my PHP SCRIPT
     

<pre><code>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');

?&gt;
</code></pre>

<p>Please help in this regards.</p>

<p>Thanks...</p>