Re: Files without type???

From: Date: Wed, 18 Apr 2001 06:48:03 +0000
Subject: Re: Files without type???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-49132@lists.php.net to get a copy of this message
On Wed, 18 Apr 2001 15:53, Morten Winkler Jørgensen wrote: > Hi php'ers > > Executing the following code on my Redhat 7.2 box, through Apache i > get the most annoying output: > > Code: > > function listDirectory($basedir){ > $diary_directory = opendir($basedir); > while($filename = readdir($diary_directory)) { > if(strcmp(".", $filename) != 0) { Here you need to prefix the full path ($basedir ?) to $filename, else the script will try to find the file in the current working directory. > if(strcmp("..", $filename) != 0) { > print("<br>$filename is \""); > print filetype($filename)."\""; > } > } > } > closedir($diary_directory); > } > listDirectory("."); > > Output (sample): > index.php is "" (should be "file") > Ansatte is "" (should be "dir") > Produkter is "" (should be "dir") > Kontorer is "dir" > view.php3 is "" (should be "file") > > > What could possibly be the error? > > > Kind regards, > Morten Winkler -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#49132) next »