[function.filemtime]:stat失败

I have a script that reads the filemtime of zip files fine when I have the script in the same directory as the files. I can define the $dir two ways and both work.

EG:

$dir  = getcwd();  
//or  
$dir  = "/home/blahblah/public_html/thedirectory/";

However if I place the script in public_html directory I get this error

Warning: filemtime() [function.filemtime]: 
stat failed for TheZipFileNameWithoutTheExtension 
in /home/blahblah/public_html/listbydate.php 
on line 173

Any clues on why this is happening and how to fix it? I need to place the script in a different directory to where the files are stored. Thanks!

You could use is_dir($dir) to make sure the directory you are trying to use exists.