1// Will copy foo/test.php to bar/test.php
2// overwritting it if necessary
3copy('foo/test.php', 'bar/test.php');
4
1
2<?php
3$file = 'example.txt';
4$newfile = 'example.txt.bak';
5
6if (!copy($file, $newfile)) {
7 echo "failed to copy $file...\n";
8}
9?>
10
11
1$file = 'http://3.bp.blogspot.com/-AGI4aY2SFaE/Tg8yoG3ijTI/AAAAAAAAA5k/nJB-mDhc8Ds/s400/rizal001.jpg';
2$newfile = '/img/submitted/yoyo.jpg';
3
4if ( copy($file, $newfile) ) {
5 echo "Copy success!";
6}else{
7echo "Copy failed.";
8}