Web Hosting Forums

Results 1 to 6 of 6

This is a discussion on Warning: filetype() [function.filetype]: Lstat failed in the Hosting Talk & Chit-chat forum
hi i want get the list of files in the particular folder. but when i use filetype function i got following error. Warning: filetype() [function.filetype]: ...

  1. #1
    Loyal Client
    Join Date
    Oct 2006
    Posts
    19

    Warning: filetype() [function.filetype]: Lstat failed

    hi
    i want get the list of files in the particular folder. but when i use filetype function i got following error.

    Warning: filetype() [function.filetype]: Lstat failed for e:/chinna/New_Folder/New_Folder in c:\program files\apache group\Apache\htdocs\byt\templates\newpro ject5.php on line 38

    $filepath = "filepath in array";

    foreach($filepath as $path1)
    {

    if(filetype($path1) == "dir")
    {

    if ($dh1 = opendir($path1))
    {
    // iterate over file list
    // print filenames
    while (($filename1 = readdir($dh1)) !== false)
    {
    if (($filename1 != ".") && ($filename1 != ".."))
    {

    echo $path1 . "/" . $filename1 . "\n";
    //$filepath[$count] = $path1 . "/" . $filename1 . "\n";
    }
    }
    // close directory
    closedir($dh1);
    }
    } //if end here
    }
    Any help will be greatly appreciated.

    Thanks

    Regards
    Chinna

  2. #2
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    5,884
    Its hard to know what you are passing to filetypefrom the code you posted. My guess is that you aren't passing it sufficient data.

    Filetype expects a path to a file, either absolute or relative to the script that's running. So, assuming that your $filepath looks something like this:

    PHP Code:
    $filepath = array('abc''def''ghi'); 
    and your script is running from public_html, the first iteration of the loop will be looking for /home/USERNAME/public_html/abc, which may or may not be what you really want.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  3. #3
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    5,884
    <edit>Accidental double post. Funny, these boards usually prevent you from doing that...</edit>

    --Jason
    Last edited by jason; 10-30-2006 at 09:48 AM.
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  4. #4
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    5,884
    <edit>I know what I'm doing...really! </edit>

    --Jason
    Last edited by jason; 10-30-2006 at 09:48 AM.
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  5. #5
    Loyal Client
    Join Date
    Oct 2006
    Posts
    19
    iam not done any double post, what is this. i want to know...

  6. #6
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    5,884
    The double post was mine, not yours. After I posted my reply I noticed that it got posted twice. When I went to edit the second one, I must have accidentally quoted it instead of editing it because I ended up posting a third time!

    Long story short, I was at fault, not you. Sorry that I lead you to interpret it differently.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

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
  •