FTP a file
| From: | Chris Murtland | Date: | Sat, 22 Jul 2000 20:43:58 +0000 |
| Subject: | FTP a file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7715@lists.php.net to get a copy of this message | ||
I am trying to ftp a file to my machine, using fopen and fwrite. Here is my
code (paths and IP changed to protect the guilty):
$fs=fopen("/home/db.txt","r");
$size=filesize("/home/db.txt");
$body = fread($fs,$size);
fclose($fs);
$fp = fopen("ftp://user:password@$ip/upload/db.txt",
"w");
fwrite($fp,"$body \r\n",$size);
fclose($fp);
It successfully logs into my FTP server and creates a blank file named
db.txt in the upload directory. How do I get it to write the contents to the
file?
I don't have the ftp functions installed on my server, so I can't use those.
Thanks,
Chris
---------------------------------------------
Chris Murtland
Studio Moxie, LLC
336.773.1684
877.284.0462 fax/voicemail
62384610 ICQ