Hello,
On Jan 2, 2006, at 12:27 AM, suma parakala wrote:
Hi
Can anyone tell me how can we copy one file from one server to another
server using PHP
Thanks
Suma
I use this function to grab mp3's from one server and place them on
another (transfers 10mb files rather nicely):
function grab_mp3($in, $out) {
$remote = fopen($in, 'r');
# Remember to chmod download folder to 777:
$local = fopen('test/'.$out, 'w+');
if(!$remote) {
// handle failed request here ...
echo "Oops!";
}
else {
while (!feof($remote)) {
# Use @ to supress warning messages:
@$a .= fread($remote, 8192);
}
}
fwrite($local, $a);
fclose($remote);
fclose($local);
# Bye bye.
}
You could also use cURL:
http://us3.php.net/curl
Hth,
Cheers,
Micky
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php