SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ftp_nlist() some servers add slashes to folder/file names, some don't why? and fix?

    Hi,

    A question for you guys.

    I am connecting to an FTP server through php. Using ftp_nlist() I get a list of folders and files from the current directory and depending on the server I get a different style of naming back.

    On my laptop I am running the FTP server that came with Xampp (filezilla) and it shows me folder/file names (from now folder names) like so (I don't get the full tree straight away, but I wrote it down to illustrate the different levels):

    /app
    /app/controllers
    /app/index.php
    /cake
    /etc
    /index.php

    On my desktop I use the same code but I connect to a different host, namely my hosting provider, which runs some linux web server and I get this for the same folders and files:

    app
    controllers
    index.php
    cake
    etc
    index.php

    I depend quite a bit on the way the names are shown and I want to know why the nlist is different.

    Of course a solution could be that I check if there is a '/' in the name and then explode on it and then use the highest key value. But I want to force one of both ways onto the connection.

    Why and how?

  2. #2
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That should have been:
    Code:
    /app
      /app/controllers
      /app/index.php
    /cake
      /etc
    /index.php

    Code:
    app
      controllers
      index.php
    cake
      etc
    index.php


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •