function ftp($file){
echo "FTP\n";
$remote_file = $file;
$ftp_server="172.20.8.4";
$ftp_user_name="user";
$ftp_user_pass="pw";
// set up basic connection
$conn_id = ftp_connect($ftp_server);
//echo "Res1 $conn_id<br>";
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
//echo "Res2 $login_result<br>";
// upload a file
if($login_result){
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
echo "Successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}
}else
echo "FTP Fail\n";
// close the connection
ftp_close($conn_id);
//echo "OK";
}