0
   

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

 
 
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 to this Topic
Type: Question • Score: 0 • Views: 2,997 • Replies: 0
No top replies

 
 

Related Topics

\n - Question by negikaithal
PHP question about parse_url - Question by markalanbaker1
What does \n mean in PHP Code? - Discussion by roverroad
PHP Debate - Discussion by Craven de Kere
PHP: Cookie Problem - Discussion by BobbyDouglas
Installing PHP with IIS - CGI Error - Discussion by skinnz
Displaying <?php in javascript. - Discussion by BobbyDouglas
php software - Question by aishna
 
  1. Forums
  2. » In PHP, how do you distinguish a File and Directory?
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/24/2024 at 10:01:08