how to list all the directories of ftp server of iis using php for download -


i set iis server in windows , set list of folders should downloaded. connected server using php too.

$username=$_post["username"];   $password=$_post["paswd"]; $host="localhost"; $ftpcon= ftp_connect($host) or die("could not connect"); $login=ftp_login($ftpcon,$username,$password); 

now want list windows directory. me navigate file explorer in windows. mind giving me here

try below code list files & directories:

<?php $ftp_server =   'xxx.xx.xx.xx';//replace ip $conn_id    =    ftp_connect($ftp_server);  # login username , password $user   =   'ftp_user_name'; //replace ftp user name $passwd =   'ftp_password'; //replace ftp password $login_result = ftp_login($conn_id, $user, $passwd);  # check connection if (!$conn_id)  {     echo "ftp connection has failed!";     echo "attempted connect $ftp_server user $user";     exit(); } else  {     $cwd            =   ftp_pwd($conn_id);     $contentlist    =   ftp_nlist($conn_id, "."); // denotes current path, can replace actual path      foreach($contentlist $contentlistitem)      {         if (ftp_size($conn_id, $contentlistitem) == -1)         {             #its direcotry             echo  "directory : ".$contentlistitem."<br>";         }         else         {             #its file             echo  "file : ".$contentlistitem."<br>";         }     } } ?> 


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

json - Gson().fromJson(jsonResult, Myobject.class) return values in 0's -