[function.filemtime]: stat failed for *FILE* error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
ozzy
Forum Commoner
Posts: 74
Joined: Tue Apr 11, 2006 4:45 pm

Post by ozzy »

feyd wrote:the usage of basename() explains why. The file doesn't exist in the local directory, so filemtime() can't find the file.
Thanks, using your info i added:

Code: Select all

$location = "vuns/files/";
and directed the time using that:

Code: Select all

. date ("F d Y H:i:s.", filemtime($location))
------
Onto my next problem...

All the dates and times which are being displayed are:

Code: Select all

April 16 2006 07:38:22.
:(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You're requesting the modification time of a directory, not a file inside that directory.
User avatar
ozzy
Forum Commoner
Posts: 74
Joined: Tue Apr 11, 2006 4:45 pm

Post by ozzy »

How would i fix this?

It tyed changing

Code: Select all

$location = "vuns/files/";
to

Code: Select all

$location = "vuns/files/$filename";
But that didnt work
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Why even use basename() if you're adding the directory back on?

You can use basename() after the call to filemtime() to do whatever you are using the file name for.
User avatar
ozzy
Forum Commoner
Posts: 74
Joined: Tue Apr 11, 2006 4:45 pm

Post by ozzy »

I know how to insert the basename, or insert the filename. But what i need to do is insert them both together to so that it can get the date and time, but how would i need to change the code below to do that?

Code: Select all

. date ("F d Y H:i:s.", filemtime($location));
User avatar
ozzy
Forum Commoner
Posts: 74
Joined: Tue Apr 11, 2006 4:45 pm

Post by ozzy »

Sorry about the double post, but i have managed to do it.

Code: Select all

. date ("F d Y H:i:s.", filemtime($location . $filename));
Post Reply