By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,961 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,961 IT Pros & Developers. It's quick & easy.

Listing aliased directory

P: n/a
xEM
I have in Apache2 (win32) aliased directory, for example:

Alias /ftp/mp3/ "D:/mp3/"
<Directory "D:/mp3">
....
</Directory>

Address to this directory will be: http://localhost/ftp/mp3/

How can i list files in that directory?

# This works for full-path directory on my hdd, but not for aliased:
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file\n";
}
}
closedir($handle);
}
--
pozdr.
xEM~
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Sat, 22 Nov 2003 09:53:58 +0000 (UTC), xEM <xe**@boxmail.biz> wrote:
I have in Apache2 (win32) aliased directory, for example:

Alias /ftp/mp3/ "D:/mp3/"
<Directory "D:/mp3">
...
</Directory>

Address to this directory will be: http://localhost/ftp/mp3/

How can i list files in that directory?

# This works for full-path directory on my hdd, but not for aliased:
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo "$file\n";
}
}
closedir($handle);
}


You can use apache_lookup_uri to translate the URL into a filesystem path.

http://uk2.php.net/manual/en/functio...lookup-uri.php

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #2

P: n/a
xEM
Andy Hassall <an**@andyh.co.uk> wrote in
news:2p********************************@4ax.com:
You can use apache_lookup_uri to translate the URL into a filesystem
path.

http://uk2.php.net/manual/en/functio...lookup-uri.php


It works well on Apache 1.3 but not on 2.0 :(

http://rok.codeartists.com/projects/digital_archive/

--
pozdr.
xEM~
Jul 17 '05 #3

P: n/a
On Sat, 22 Nov 2003 15:54:59 +0000 (UTC), xEM <xe**@boxmail.biz> wrote:
Andy Hassall <an**@andyh.co.uk> wrote in
news:2p********************************@4ax.com :
You can use apache_lookup_uri to translate the URL into a filesystem
path.

http://uk2.php.net/manual/en/functio...lookup-uri.php


It works well on Apache 1.3 but not on 2.0 :(

http://rok.codeartists.com/projects/digital_archive/


Works fine for me on PHP 4.3.3, Apache 2.0.44. What problem are you having?

<pre>
<form action="" method="get">
<input type="text" name="url" value="<?php echo
htmlentities(@$_GET['url']);?>" />
<input type="submit" />
</form>
<?php
if (isset($_GET['url']))
print_r(apache_lookup_uri($_GET['url']));
?>
</pre>

Gave the right looking results for various aliases on my system.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.