I'm trying to get the date and time of the last modification of some files using filemtime
. Unfortunately, this is failing for all of my files. I've tried using the full, complete path (e.g. www.mysite.com/images/file.png). I've tried just using the extension (e.g. /images/file.png) and also just the file name itself (file.png). Nothing is working. How can I pass the path reference so that it can find my files? Thanks!
<br />n<b>Warning</b>: filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for www.mysite.com/images/hills.png in <b>D:\Hosting\11347607\html\mobile\updateImages.php</b> on line <b>20</b><br
This is the php script:
<?php
include '../scripts/connection.php';
//get information on this location from the database
$sql = "SELECT * FROM types";
$result = mysql_query($sql);
$array = array();
while ($row = mysql_fetch_array($result)) {
$path = $row['path'] . $row['picture_url'];
$last_mod = filemtime($path);
$this_file = array(
'filename' => $row['picture_url'],
'last_mod' => $last_mod
);
$array[$row['type']] = $this_file;
}
echo json_encode(array('result'=>'success', 'message'=>$array));
?>