ftp_systype can be a good way of checking the state of a connection, since PHP doesn't have a better system to check the state of an ftp connection (is_connected would be nice).
if (!($type = ftp_systype($conn_id))) {
echo "FTP connection has failed! Trying again.\n";
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
}