Re: transfer file

From: Date: Wed, 14 Jun 2006 03:05:10 +0000
Subject: Re: transfer file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-237946@lists.php.net to get a copy of this message
kristianto adi widiatmoko wrote:
i try to transfer file from one server to another server, lets call it server A to server B. My Idea is like this I place my script in server A <?php $local = fopen("file.txt","r"); $remote = fopen("http://B/file.txt","w+); while(!feof($local)) {
    $buff = fread($local,1024);
    fwrite($remote, $buff);
} fclose($local); fclose($remote); ?> Is Any one has sugestion about it, or another method ??
You can't write files to a remote server through a web server like this. The php page (http://php.net/fopen) has an example of what you want: $handle = fopen("ftp://user:password@example.com/somefile.txt", "w"); -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#237946) next »