Results 1 to 3 of 3

Thread: read file

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    259

    read file

    Using PHP
    --------------

    I have this folder on my web site

    Mail
    Public_html

    Mail is folder that I recive my email on it
    Public_html is folder that I must upload my site files to it

    How can I read file using fopen function from Mail folder ?

    If I use that
    fopen ("/mail/file.txt")
    it will read file from here (Public_html/Mail/file.txt) becuase Public_html is the root folder but I want read file from Mail folder.

    Thanks

  2. #2
    You can do a chdir to change the working directory...

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    or you could just use the absolute path in fopen().

    However, if you just want to read the file to a variable, just do:

    $stuff = file("/path/to/your/file.txt");
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

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



Click Here to Expand Forum to Full Width