ini_set('output_buffering','On');
$connect=ftp_connect("localhost/ip addr") or die();
$uname="username";
$passwd="password";
$login_result=ftp_login($connect,$uname,$passwd);// Logs in to an
// FTP connection
$dir="/home/sameer/wallpaps";
$dir_list=ftp_nlist($connect,$dir);// Returns a list of files in the //given directory
$i=0;
foreach($dir_list as $file)
{
if(preg_match("/*.jpg/",$file))
{
echo "$file";
ftp_get($connect,$newfile[$i],$dir.$file,FTP_ASCII);
$i++;
//Downloads a file from the FTP server
}$i++;
//Downloads a file from the FTP server
}
ftp_close($connect);
?>
.jpg)
No comments:
Post a Comment