0

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!

Stev
  • 73
  • 1
  • 9

1 Answers1

0

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

JMc
  • 355
  • 1
  • 6
  • Thanks for the suggestion. I know the directory exists as $dir = "/home/blahblah/public_html/thedirectory/"; works when I place the script in /home/blahblah/public_html/thedirectory/. It just doesn't work when I place it in /home/blahblah/public_html/. – Stev Nov 02 '14 at 21:14
  • It seems that "thedirectory" is not visible in your public_html folder. By that I mean, the public_html ignores the folder. You could move the script to "blahblah", change the directory path, then test it. – JMc Nov 03 '14 at 13:45