xampp - PHP error object not found -
i have created small php file displays name of text files in directory first.txt
, second.txt
, third.txt
. on clicking on of files error "object not found".
this not work:
localhost/applications/xampp/xamppfiles/htdocs/learning/listingfiles/first.txt
but works:
file:///applications/xampp/xamppfiles/htdocs/learning/listingfiles/first.txt
can me understand wrong?
here code:
<?php $directory = '/applications/xampp/xamppfiles/htdocs/learning/listingfiles'; if ($handle = opendir($directory.'/')){ echo 'looking inside'.$directory.'<br>'; while ($file = readdir($handle)){ if ($file != '.'&&$file != '..'){ echo '<a href="'.$directory.'/'.$file.'">'.$file.'</a><br>'; } } } ?>
following updates of log file
- [thu jul 18 01:06:57 2013] [error] [client ::1] file not exist: /applications/xampp/xamppfiles/htdocs/xampp/xamppfiles
- [thu jul 18 01:15:14 2013] [error] [client ::1] file not exist: /applications/xampp/xamppfiles/htdocs/applications, referer: localhost/learning/listingfiles/file.php
- [thu jul 18 01:15:43 2013] [error] [client ::1] file not exist: /applications/xampp/xamppfiles/htdocs/applications, referer: localhost/learning/listingfiles/file.php
- [thu jul 18 01:17:13 2013] [error] [client ::1] file not exist: /applications/xampp/xamppfiles/htdocs/applications, referer: localhost/learning/listingfiles/file.php
- [thu jul 18 01:39:04 2013] [error] [client ::1] file not exist: /applications/xampp/xamppfiles/htdocs/learning/listingfiles/function.opendir, referer: localhost/learning/listingfiles/file.php
try using
$dir = "/applications/xampp/xamppfiles/htdocs/learning/";
as main path files in it.
this full path or "../learning" should right directory files.
when creating link you'll want use "/learning/" + filename give path file.
thanks, mystream
Comments
Post a Comment