Domanda

Hi i am looking for script witch lists directory's from ftp and read's all files from the listed folder..Is there something that can help me?

  1. > //open the dir



    $sub = ($_GET['dir']); $path = 'store/'.$diro.'/'; $path = $path . "$sub"; $dh = opendir($path); $i=1; while (($file = readdir($dh)) !== false) { if($file != "." && $file != "..") { if (substr($file, -4, -3) =="."){ echo "$i. $file
    "; }else{
    echo "$i. $file"; } $i++; } } closedir($dh);

È stato utile?

Soluzione

I did a quick Google, and there a MILLIONS of responses to this question.

The fourth result is a complete code sample.

http://www.phpreg.com/index.php?option=com_content&task=view&id=158&Itemid=28

Something like....

<?php
     $connect = ftp_connect("ftp.hostname.com");
     $result = ftp_login($connect, "username", "password");
     $a = ftp_nlist($connect, "code22");
     foreach($a as $value){
         echo $value, "<BR>";
     }
?>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top