Php rename and copy files. Php rename and copy the file $ nname $ nowpath. $ newfilename; if (file_exists ($ nname) |! File_exists ($ oldname) {m ($ nname. the target file already exists or the original file does not exist); rename and copy the file in php
$ Nname = $ nowpath. $ newfilename;
If (file_exists ($ nname) |! File_exists ($ oldname )){
M ($ nname. 'The target file already exists or the original file does not exist ');
} Else {
M (basename ($ oldname). 'Rename '. basename ($ nname). (@ rename ($ oldname, $ nname )? 'Success': 'failed '));
}
}
// Copy an object
Elseif ($ sname & $ tofile ){
If (file_exists ($ tofile) |! File_exists ($ sname )){
M ('target file already exists or the original file does not exist ');
} Else {
M (basename ($ tofile). 'copied'. (@ copy ($ sname, $ tofile )? Basename ($ tofile). 'success': 'failed '));
}
Http://www.bkjia.com/PHPjc/445025.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445025.htmlTechArticlephp rename and copy file $ nname = $ nowpath. $ newfilename; if (file_exists ($ nname) |! File_exists ($ oldname) {m ($ nname. 'The target file already exists or the original file does not exist ');...