On 10 February 2010 16:31, Pat <patrick.j.rice@xxxxxxxxx> wrote: > hi all > having trouble here with a site that I am hosting on go-daddy > > I want to keep my php and my images apart > > so to do this I have the base directory which contains the php scripts. On > the directory above that I have > my photos stored in /photos > > when I run my scripts I get the following: > > time -4 hours1265815323 < > *Warning*: filemtime() [function.filemtime > <http://www.patrickrice.net/tomdcam/function.filemtime>]: stat failed for > testPanasonicCamMotion20100201022429140.jpg in > */home/content/j/a/c/jackcards/html/tomdcam/MotionCamLast1Hours.php* on line > *16* > > 1265815323 > > *Warning*: filemtime() [function.filemtime > <http://www.patrickrice.net/tomdcam/function.filemtime>]: stat failed for > testPanasonicCamMotion20100201022429140.jpg in > */home/content/j/a/c/jackcards/html/tomdcam/MotionCamLast1Hours.php* on line > *28* > 0 > time -4 hours1265815323 < > *Warning*: filemtime() [function.filemtime > <http://www.patrickrice.net/tomdcam/function.filemtime>]: stat failed for > testPanasonicCamMotion20100201022619570.jpg in > */home/content/j/a/c/jackcards/html/tomdcam/MotionCamLast1Hours.php* on line > *16 > > *_The script is the following below _from running this script, I keep > getting this error, now when I copy this script in to the directory photo > where the photos are stored, the script displays the images with no problems > leaving me think that the issue is with the permissions, I have modified the > pre-emptions to give all access as a test and still problems. Anyone got any > Ideas?? > > Thanks in advance. > Pat > > 6 <?php > 7 $debug =1; > 8 $d = dir('/home/content/j/a/c/jackcards/html/tomdcam/photo/') or > die($php_errormsg); > 9 while (false !== ($f = $d->read())) { > 10 // only match alphabetic names > 11 if (preg_match('/testPanasonicCamMotion/',$f)) { > 12 > 13 if ($debug == 1) { > 14 echo "time -4 hours" . strtotime("- 1 hours" ). " < "; > 15 > 16 echo filemtime($f); > 17 echo " <br>"; > 18 }//end debug > 19 > 20 $FourHoursAgo = intval(strtotime("- 1 hours" )); > 21 > 22 if ($debug == 1) { > 23 echo $FourHoursAgo; > 24 # 25 echo "<br>"; > 26 } > 27 > 28 $dateOfFileModify = intval(date((filemtime($f)) )); > 29 > 30 if ($debug == 1) { > 31 echo $dateOfFileModify; > 32 echo "<br>"; > 33 } > 34 > 35 > 36 if ($FourHoursAgo < $dateOfFileModify) > 37 # if(intval(strtotime("- 4 hours" )) < > intval(strtotime(filemtime($f))) ) > 38 > 39 # if (strcmp(strtotime("- 4 hours" ),strtotime(filemtime($f)) ) > > 0) > 40 > 41 { > 42 #echo '<br> Images less than 4 hours <br>'; > 43 > 44 > 45 > 46 > 47 print "filename: $f <br>"; > 48 print "<IMG SRC=\"$f \"> <br>\n"; > 49 > 50 # echo "Last accessed on: " . date("d-m-y H:i:s", strtotime("+ 8 > hours", fileatime($f)) ); > 51 # echo "<br>"; > 52 echo "Last modified on: " . date("d-m-y H:i:s", strtotime("+ 8 > hours", filemtime($f)) ); > 53 echo "<br> <hr>"; > 54 }//end of if statment > 55 > 56 > 57 # else { > 58 # print " <br> None Found <br>"; > 59 # } > 60 } > 61 } > 62 $d->close(); > 63 > 64 > 65 ?> > > * > * > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > read() only returns the filename, not the full path. So, when the script is in the same directory, the current directory contains the required file. Try using ... filemtime(realpath($f)) instead. -- ----- Richard Quadling "Standing on the shoulders of some very clever giants!" EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php