ZeroGS
ZeroGS

Reputation: 139

PHP ftp_nlist stuck on Rootfolder

I'm having a very strange Problem with a new Script of mine. It's just intended to list all files in a specific Folder but from ftp_nlist all i get in return are the folders located on the Root of the FTP!

Here's a snipped of the code

<?php
  $ftpServer = "192.168.10.190";
  $ftpUser = "user1";
  $ftpUser = "somePass";
  $remoteFilePath = "/SomeFolder/";

  $conn_id = ftp_connect($ftpServer) or die("<span style='color:#FF0000'><h2>Couldn't connect to $ftpServer</h2></span>");
  $login_result = ftp_login($conn_id, $ftpUser, $ftpPass) or die("<span style='color:#FF0000'><h2>You do not have access to this ftp server!</h2></span>");
  $files = ftp_nlist( $conn_id, $remoteFilePath );
  echo print_r($files)."<br>";
?>

Anyone with an Idea what is going on?!

Solution

I've found it out on my own. All i had to do was putting the ftp_nlist in a if clause that changed to the desired directory ;)

Upvotes: 0

Views: 404

Answers (1)

Oli
Oli

Reputation: 840

Try

$remoteFilePath = "./SomeFolder/";

with the dot for explicitly referring to the current directory.

Upvotes: 1

Related Questions