Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fileatime, filesize and filetype

Status
Not open for further replies.

handle12323578

Programmer
Feb 7, 2005
3
US
When I read files from the directory, I get "Warning: filesize(): Stat failed for sample10.doc (errno=2 - No such file or directory)" message for doc and xls files. Same warning messages for fileatime and filetype. Can anyone help me solve this problem?
 
i would guess you are forgetting to append the path to the filesize() call.

Code:
clearstatcache();
$path = "/some/directory/";
$dh = opendir($path);
while (false !== ($file = readdir($dh))){

 echo "File name: $file <br/>";
 if (is_file($path.$file)){
   echo "File size: " . filesize($path.$file) . "<br/><hr/>";
 }
}
 
Yes, after I put the path, it's working fine. How come I didn't get error to jpg, gif or other? They listed correctly.
 
two possible reasons. one is that there are files with those names already in the relative directory and the second that that such files used to exist and that their data is still in the stat cache.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top