php — загрузка всех файлов из каталога на FTP
<?php$host = "hostname";
$connect = ftp_connect($host);
if (!$connect)
{echo "connect fail<br/>";
}else{echo "connect ok<br/>";
}$user = "username";
$password = "some_pass";
$result = ftp_login($connect, $user, $password);
$dir = ftp_pwd($connect);
echo $dir."<br/>";
$od = opendir('md');
while ($local_file = readdir($od))
{if ($local_file != "." && $local_file != "..")
{echo $local_file."<br/>";
$upl_file = "md/".$local_file;
$remote_file = "remote_".$local_file;
if (ftp_put($connect, $remote_file, $upl_file, FTP_BINARY))
{echo "upload ok<br/>";
}else{echo "upload fail<br/>";
}}}$cl = closedir($od);
ftp_quit($connect);
?>