[thelist] Problem with php filesize()

Chris George chrisg at gsnet.com
Sun Jun 17 10:54:51 CDT 2001


I hope this doesn't get posted twice, but it doesn't look like my first post
came through. Here's what I said:

Chris,

I was going through the comments in the online PHP documentation on readdir
and filesize and caught this:

"When executing a "readdir" command, filesize doesn't seem able to get the
size of some files if they aren't in the same directory as the script. The
workaround to this is changing the working directory with "chdir" in
addition to "readdir"."

Could this be your problem?

http://www.php.net/manual/en/function.filesize.php

--
cdg

----- Original Message -----
From: "CDitty" <mail at redhotsweeps.com>
> Does anyone know if there are any problems with filesize in php
> 4.0.4pl1?  I am simply trying to get the filesize of a graphic and it
keeps
> showing as 0 bytes.
>
> My code will retrieve a file listing but not the size.  Any one know?
Here
> is my code.
>
> <?
> $new_file_name = "cditty.jpg";
> $userid = "cditty";
> $handle = opendir("/home/$userid");
> while(false!==($file = readdir($handle))){
>      if($file == "cditty.jpg"){
>           echo $file . " " . filesize($file) . "<br>";
>      }
> }
> ?>
>
> Thanks
>
> Chris





More information about the thelist mailing list