Jump to content
php.lv forumi

traverse FTP dir


Blitz

Recommended Posts

Nr:1

Kaa var taisit "traverse dir" ja dir stav uz ftp servera izmantojot rekursiju?

Manuaali neatrodu kadu lidzigu funkciju "readdir", ko varetu piemerot ftp?

Nr. 2

anonimajam lietotajam ir tiesibas brivi rikoties ar ftp failiem un direktorijam (dzest, kopet, ielikt utt.), kad teiksim izmantoju:

 

$conn_id=ftp_connect("foto");

$a=ftp_mkdir($conn_id,"www");

 

tad izsviez ka access diened. Kapec taa, ja tiesibas ir to darit!

Link to comment
Share on other sites

Blin nu cik var atkārtot!!!!!!!

LASI MANUĀLI - piemērs ir turpat!!!!!

 

<?php

function filecollect($conn_id,$dir='.') {
 static $flist=array();
 if ($files = ftp_nlist($cid,$dir)){
  foreach ($files as $file) {
    if (ftp_size($cid, $file) == "-1"){
      filecollect($cid,$file);
    } else $flist[] = $file;
  }
 }
 return $flist;
}

$conn_id = ftp_connect('ftp.nowhere.com') or die("Couldn't connect to server");
 if (@ftp_login($conn_id, 'anonymous', 'pass@nowhere.com')){
  $filelist = filecollect($conn_id);
  echo "<pre>";
    print_r($filelist);
  echo "</pre>";
 }

?>

Link to comment
Share on other sites

×
×
  • Create New...