How to use copy in PHP Filesystem
In this article I am going to explain about copy function in PHP Filesystem.
PHP copy() function
The filesystem copy function is used to copies a file and it returns true on success otherwise return false.
Syntax of copy function
Parameters in copy function
It have two parameter:
Parameter |
Description |
file |
Path to the source file. |
tofile |
Path of the destination file. |
Example of filesystem copy function
<html>
<body>
<?php
$file = 'C:\wamp\www\Dinesh\Mcn.txt';
$newfile = 'C:\wamp\www\Dinesh\Mcn1.txt';
if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
}else{
echo "copied $file into $newfile\n";
}
?>
</body>
</html>
|
Output:
You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here