How i can copy one file from one directory to another directory using php
4 Answers
You can use
copy— Copies file
Example from Manual:
$file = 'example.txt'; $newfile = 'example.txt.bak'; if (!copy($file, $newfile)) { echo "failed to copy $file...\n"; } Comments
2 Comments
Shinu Thomas
it is working fine.But it is deleted from the source i Want it in the source also
If you are moving a file just uploaded, use http://php.net/manual/en/function.move-uploaded-file.php instead of rename(). It gives you some added security.