SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    New York
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Opening an anon ftp directory using readdir()

    I just moved all my downloads from http to ftp and I was having some trouble modifying my scripts..

    What I had before was:
    PHP Code:
    $dir="./ghdl/Files346tlm/file";
    $sizedir $dir;
     
    $dir opendir("$dir");
      while(
    $item readdir($dir)){ ... 
    which was http://www.pregaming.com/ghdl/...

    but now its ftp so I have to change the dir.

    Web location: ftp://pregaming.com/pub/....
    Server location: /anon_ftp/pub...

    I tried both

    PHP Code:
    $dir=".anon_ftp/pub/..."
    and

    PHP Code:
    $dir="ftp://pregaming.com/pub/..."
    but both didn't work

    (got the error:
    Code:
     Warning: OpenDir: No such file or directory (errno 2) 
    Warning: readdir(): supplied argument is not a valid Directory resource
    )

    Any ideas? Thanks
    TightBeatZ.com: Free Underground Hip-Hop loops
    Pregaming.com: Game Videos and Trailers

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Have a look at the FTP functions in the PHP manual.

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    New York
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DJ P@CkMaN
    Have a look at the FTP functions in the PHP manual.
    So I can't use opendir() and readdir() when using ftp?
    TightBeatZ.com: Free Underground Hip-Hop loops
    Pregaming.com: Game Videos and Trailers

  4. #4
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    No, because FTP is it's own protocol, readdir() only works on the local filesystem.

  5. #5
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if fopen wrappers are enabled then eg readfile('ftp://userassword@yourdomain.com/') should work ?

  6. #6
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Well, that's too advanced for me


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
  •