Google Search

Google Search

HTML/JavaScript

Thursday, September 1, 2011

Copy File

function copyFile($url,$dirname){
@$file = fopen ($url, "rb");
if (!$file) {
// echo"Failed to copy $url!
";
return false;
}else {
$filename = basename($url);
$fc = fopen($dirname."$filename", "wb");
while (!feof ($file)) {
$line = fread ($file, 1028);
fwrite($fc,$line);
}
fclose($fc);
//echo "File $url saved to PC!
";
return true;
}
}


copyFile("../".$dir_path,"../".$dir_path1);

No comments:

Post a Comment