Tuesday, July 24, 2012

Copy And Paste File content



Copy And Paste File Content


You can copy content of one file and paste it in same type of empty file

Copy and Paste a File

Select File
To be copied
Select empty File
To be Pasted

PHP Syntax is bellow

<html>
<head><title>Copy and paste File</title>

</head>
<body >
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

<table bgcolor=#d9e5a2>
<tr>
<td colspan="4" align ="center"><h3>Copy and Paste a File</h3></td>
</tr>
<tr>
<td><strong> Select File</br> To be copied</strong></td>
<td><input type="file" id="sourcefile" name="sourcefile"></td>
<td><strong> Select empty File</br> To be Pasted</strong></td>
<td><input type="file" id="destinationfile" name="destinationfile"></td>
</tr>
<tr>
<td> </td> <td> </td><td><input type="submit" name="copy" value="Copy/Paste"/></td>
</tr>
</table>
</form>
<?php
if($_POST["copy"]){
$sourcefile = $_POST["sourcefile"];
$destinationfile = $_POST["destinationfile"];
copy($sourcefile,$destinationfile);
}
?>
</body>
</html>

No comments:

Post a Comment