function copyFile($url,$dirname){
@$file = fopen ($url, "rb");
if (!$file) {
echo"<font color=red>Failed to copy $url!</font><br>";
return false;
}else {
$filename = basename($url);
$fc = fopen($dirname."$filename", "wb");
while (!feof ($file)) {
$line = fread ($file, 1028);
fwrite($fc,$line);
}
fclose($fc);
echo "<font color=blue>File $url saved to PC!</font><br>";
return true;
}
}
I can use this function to copy remote image file, but when I try to use it to copy remote zip file, it gave the error "could not open input file". So I think fopen on zip, I need to set it up differently?
Any advices?
Thanks a lot.