note 3782 modified in FTP functions by ronabop
| From: | ronabop@php.net | Date: | Thu, 17 Aug 2000 09:42:03 +0000 |
| Subject: | note 3782 modified in FTP functions by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-2134@lists.php.net to get a copy of this message | ||
Here is an example that works:
<p>
$connid = ftp_connect("$host");
if (!$connid)
{
echo "Error: Ftp connection has failed!\r\n";
die;
}
echo "Connected! [ID: $connid]\r\nAttempting logon...\r\n";
// Attempt login. False = error
$result = ftp_login($connid, "$user", "$pass");
if (!$result)
{
echo "Error: Ftp logon for user [$user] has failed!\r\n";
ftp_quit($connid);
die;
}
echo "User [$user] logged in successfuly!\r\n\r\n";
echo "Putting [./sourcefile.zip] on remote server...";
$success = ftp_put($connid, "./targetfile.zip", "./sourcefile.zip",
FTP_BINARY);
// Finally, close the FTP stream
ftp_quit($connid);
http://www.php.net/manual/ftp-functions.php