note 31783 deleted from function.ftp-nlist by didou

From: Date: Sun, 16 Jan 2005 05:42:43 +0000
Subject: note 31783 deleted from function.ftp-nlist by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-83382@lists.php.net to get a copy of this message
Note Submitter: zanzamarr at yahoo dot com dot au ---- To have a list with all files in a choosed folder use this code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Connessione</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="stile.css" /> </head> <body> <?Php $ftp_server = $_POST['host']; $ftp_user_name = $_POST['nome_utente']; $ftp_user_pass = $_POST['password']; $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); if ((!$conn_id) || (!$login_result)) { echo "La connessione FTP è fallita!"; echo "Tentativo di connessione a $ftp_server per l'utente $ftp_user_name"; die; } else { echo "Connesso a $ftp_server, utente $ftp_user_name"; } $cartella = ftp_pwd($conn_id); if ($cartella = "/"){ echo "<br /> Sei nella cartella : Home<br /><br />"; }else{ echo "<br /> Sei nella cartella : $cartella<br />"; } $form = "<form action=\"". $_SERVER["PHP_SELF"] ."\" method=\"POST\"> <select>"; $list = Array(); $list = ftp_nlist($conn_id, "$cartella"); while(list($chiave,$valore) = each($list)) { $dir = $conn_id."/".$valore; if( !is_dir($dir) && $dir != "." && $dir != "..") { $form .= "<option>".$valore."</option><br />"; } } $form .= "</select></form>"; echo $form; ?> </body> </html>

« previous php.notes (#83382) next »