Quote Originally Posted by techgnome View Post
Except for one point, it seems like it should be right... but I can't quite place my finger on it...
the one place that doesn't look right to me is this:
Code:
if (strpos($currentFile, '.') === false) {
                ftpRecursiveFileListing($ftpConnection, $currentFile);
            }
You're not assigning the result from the ftpRecursiveFileListing to anything... but $allFiles is static, and it would be added to it in there, so maybe it's ok.

Have your tries var_dumping $contents to see if the call of nlist is returning anything? That might be worth looking into.
Also, you may want to look at ftp_rawlist ... it has a recursive parameter... it returns a lot more than nlist does, but it also handles the recursive folder spelunking for you.

-tg
I tried changing it to ftp_rawlist() but it still doesn't give me anything, here's my current code:
Code:
<html>
<head>
  <title>Ftp List</title>
</head>
<body>
<?php
// connect and login to FTP server
$ftp_server = "<removed for forum post>";
$ftp_userName = "<removed for forum post>";
$ftp_password = "<removed for forum post>";
$dir = '/';

$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_userName, $ftp_password);

if ($login) {
    // get file list of current directory
    $file_list = ftp_rawlist($ftp_conn, $dir, true);
    
    if (!empty($file_list)) {
        echo "<ul>";
        foreach($file_list as $file) {
            echo("<li>$file</li>");
        }
        echo "</ul>";
    } else {
        echo("No directory list");
    }
    
    // close connection
    ftp_close($ftp_conn);
} else
    echo("Login failed on <b>$ftp_server</b> for <b>$ftp_userName</b>");
?>
</body>
</html>
I'm fairly certain that either PHP no longer does ftp, or I need to change a setting but I haven't a clue what it'd be that I would need to change.

I'm able to do all this stuff super easily in .Net though, not that knowing that helps anything here.