Space for google add

A program to read two file names from user and append contents of first file into second file.


  

A program to read two file names from user and append contents of first file

into second file.


a3seta1.html

<html>

<body>

<form method="get" action="a3seta1.php">

Enter file name:

<input type="text" name="fname1"><br>

Enter file name:

<input type="text" name="fname2"><br>

<input type="submit" name="submit" value="submit">

<input type="reset" name="reset" value="reset">

</form>

</body>

</html>



a3seta1.php

<?php

$file1=$_GET['fname1'];

$file2=$_GET['fname2'];

if(is_file($file1) && is_file($file2))

{

$fp1=fopen($file1,"r");

$fp2=fopen($file2,"a");

$a=filesize($file1);

if($fp1&&$fp2)

{

$fc=fread($fp1,$a);

fwrite($fp2,$fc);

echo "<br>File append successfully.<br>";\

fclose($file1);

fclose($file2);

}

}

else

echo "<br>File type error.<br>";

?>


Post a Comment

0 Comments