Re: Newbie: Question about filesize()

From: Date: Wed, 06 Feb 2002 15:27:50 +0000
Subject: Re: Newbie: Question about filesize()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-83776@lists.php.net to get a copy of this message
You also seem to have an extra equals. Your loop should read: while (false != ($file=readdir($handle))){ It should come up as an error, but I'm not sure. Ben Manuel Ritsch wrote: > Hello There > > I'm new to PHP and trying to code a function that reads all teh files out of > a directory and printing out a link and the filesize, > but it seems that the filesize() function doesn't work, here's the code so > far: > > $handle = opendir ('images'); > echo "Files:<br><br>"; > while (false !== ($file = readdir ($handle))) { > if($file != "." && $file != "..") > { > $file_s = filesize($file); > echo "<a href=images/$file>$file</a> Filesize: > $file_s<br>"; > } > } > closedir($handle); > > and the output is somethingl ike this: > > Files: > button_test_04.gif Filesize: > button_test_03-down.gif Filesize: > lilextras_01.gif Filesize: > (and so on)... > > You see, there's no Filesize and I don't know why, please help me > > -- manu

« previous php.general (#83776) next »