Tuesday, June 22, 2010

copy all files from 1 folder to another folder

Here is the function which is used for copy all files from 1 folder to another folder
=======================================
function copydir($dirname1,$dirname2) {

if (is_dir($dirname1))

$dir_handle = opendir($dirname1);
if (!$dir_handle)
return false;
while($file = readdir($dir_handle)) {
if ($file != "." && $file != "..") {
if (!is_dir($dirname1."/".$file))
$tempfile=fopen($dirname2."/".$file,"w+");
copy($dirname1."/".$file,$dirname2."/".$file);
//unlink($dirname1."/".$file);
}
}
closedir($dir_handle);
return true;
}

Here are the files which contain upload file function and you can upload your file by using these files.
=======================================

1./ http://www.esnips.com/doc/1bc71467-47d8-4085-9afd-d2073c725513/upload
2./ http://www.esnips.com/doc/33d8a913-5bc7-498b-9c26-74f59af4dc07/upload-file

1 comment:

Inheritx Solutions said...

Thanks for sharing very informative post.

Asp.net Development