Reply to Re: [PHP] To copy a file from one server to another server in php

Your name:

Reply:


Posted by Michael Hulse on 01/02/06 10:32

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация