note 29350 added to ref.dir
| From: | tlsprwr at hotmail dot com | Date: | Tue, 11 Feb 2003 02:35:26 +0000 |
| Subject: | note 29350 added to ref.dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43760@lists.php.net to get a copy of this message | ||
About jmb at writeme dot com's directory file listing script:
If you change the $path variable to anything other than ".", you will probably receive
errors in the file link, size, and date.
What's happening is it's trying to access "/file.ext" instead of
"/path/file.ext".
The way I have corrected this is replacing where it says the following:
$t="<a href=$file>$file</a>";
...
$t=(filesize($file)/1024);
...
$t=date("d.M Y H:i:s", filemtime($file));
and the like (if you modified it), with this:
$t="<a href=$path/$file>$file</a>";
...
$t=(filesize($path/$file)/1024);
...
$t=date("d.M Y H:i:s", filemtime($path/$file));
This may give some errors if the path is ".", but I haven't tried it. You may want to
do some if statements to correct it if it is set to view "." directory, depending on what
you're using the script for.
--
http://www.php.net/manual/en/ref.dir.php
http://master.php.net/manage/user-notes.php?action=edit+29350
http://master.php.net/manage/user-notes.php?action=delete+29350
http://master.php.net/manage/user-notes.php?action=reject+29350