1
   

In PHP, how do you distinguish a File and Directory?

 
 
View Profile Muarck
 
Reply Sat 26 Sep, 2009 05:17 pm
I'm using:

Code:$dir = dir(".");


To get the contents of the current directory.

Then I need to know which items are directories and which are files, so I'm using:

Code:while (($file = $dir->read()) !== false){

if (is_file($file) == 1) {


But on some of my *.jpg images the is file returns are null value.

And the same on:

Code:while (($file = $dir->read()) !== false){

if (is_dir($file) == 1) {


Is this an error anybody else has ever had? Have they found a way around this?


  • Topic Stats
  • Top Replies
  • Link/Embed
Type: Question • Score: 1 • Views: 122 • Replies: 0
No replies

 
 

Related Topics

Displaying <?php in javascript. - Discussion by BobbyDouglas
Installing PHP with IIS - CGI Error - Discussion by skinnz
PHP: Cookie Problem - Discussion by BobbyDouglas
PHP Debate - Discussion by Craven de Kere
What does \n mean in PHP Code? - Discussion by roverroad
What does the PHP code \n"; ?> mean? - Question by Steve Boulton
Random avatar script - Discussion by Craven de Kere
PHP/MySQL tutorials - Discussion by filfish
PHP language - Discussion by vonderjohn
 
  1. able2know
  2. » In PHP, how do you distinguish a File and Directory?
Copyright © 2009 Horizontal Verticals :: Page generated in 0.35 seconds on 11/22/2009 at 11:33:18 Top End