PHP Classes

File: example2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Tomasz Malewski  >  ADV_FTP  >  example2.php  >  Download  
File: example2.php
Role: Example script
Content type: text/plain
Description: Example 2
Class: ADV_FTP
List the files in a FTP server recursively
Author: By
Last change: make public
Date: 4 years ago
Size: 1,021 bytes


Class file image Download
// !!! Warnning this example with recursive indexing of FTP directory can spend 1-2 minutes due low network speed.

require 'adv_ftp.php';
$ftp = new adv_ftp();
$ftp->level=1; // set recursive level to 1
$ftp->conn('', 'Anonymous', 'phpclasses@adv-ftp'); // connect for FTP
$ftp->changeDir("/slackware/slackware"); // set directory
//$ftp->listFiles(); // classic dir directory
$ftp->recursive(FALSE,0); // recursive dir ditrectory

// create sample URL with FTP syntax ftp://user:password@host:port/path
echo "<table border=1><tr><th>File Name</th><th>Size</th><th>Unix Date</th></tr>";
foreach (
$ftp->dir as $file=>$key){
// print_r ($key);
"<tr><td><a href='".$url."'>".$url."</A></td><td>".$key[size]."</td><td>".$key[date]."</td></tr>\r\n";
// foreach ftp
echo "</table>";

// print_R ($ftp->dir); // list class library