SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2004
    Location
    The Netherlands
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem with is_file and mod rewrite

    hey, I am using a mod rewrite to redirect links to index.php file

    now I want to check if a file resides inside a folder on the site (using is_file), but it always return false.. even if I hard copy the link as string.

    I think it is due to the mod rewrite:

    RewriteRule !(\.gif|\.jpe?g|\.css|\.php|\.tpl|^images/.*|^files/.*)$ index.php [nocase,last]

    I removed the files part from the line but that didn't make a change..

    what can it be?

    thnx in advance

  2. #2
    SitePoint Guru enygmadae's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Tx.
    Posts
    795
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is_file is parsed before the page ever even leaves the server.
    mod_rewrite is only applied when it first comes in.

    are you using the full path to the file or just trying to do a relative path?
    PHP News, Views and Community: http://www.phpdeveloper.org

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2004
    Location
    The Netherlands
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thnx.. this is how I tested it:

    PHP Code:
    $test is_file("http://www.****.com/attachments/".$name."");
    var_dump($test); 
    it is giving me a bool(false) every time

  4. #4
    SitePoint Guru enygmadae's Avatar
    Join Date
    Sep 2002
    Location
    Dallas, Tx.
    Posts
    795
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dont use is_file with a URL....use the absolute path on the server:

    /foo/bar/baz/document_root/inc/test.txt
    versus
    http://www.foo.com/inc/test.txt
    PHP News, Views and Community: http://www.phpdeveloper.org

  5. #5
    SitePoint Zealot
    Join Date
    Jun 2004
    Location
    The Netherlands
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah thnx that worked..

    how dumb am I


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
  •