Ec (2); php copy file functioncopy ($ from, $ to) {& nbsp; if ($ this-& gt; abspath ($ to) & quot; & quot;) $ to $ this-& gt; basedir; & nbsp; if ($ this-& gt; dirname ($ from) $ this-& gt; dirname ($ to) $ to script ec (2); script
Copy files in php
Function copy ($ from, $ ){
If ($ this-> abspath ($ to) = "/") $ to = $ this-> basedir;
If ($ this-> dirname ($ from) =$ this-> dirname ($ to) $ to = $ this-> dirname ($ ). '/Duplicate '. basename ($ from );
If (! Is_dir ($ from )){
Return @ copy ($ from, $ );
} Else {
If (! Is_dir ($ to) @ mkdir ($ );
$ Path = opendir ($ from );
While ($ file = readdir ($ path )){
If ($ file = '.') | ($ file = '..') continue;
If (is_dir ($ from. '/'. $ file) $ this-> copy ($ from. '/'. $ file, $. '/'. $ file );
Else echo basename ($ file), copy ($ from. '/'. $ file, $ to. '/'. $ file )? 'Success! ': 'False .','
';
}
Return true;
}
}