Re: Can't link image directory?

From: Date: Fri, 18 May 2007 14:14:19 +0000
Subject: Re: Can't link image directory?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-255134@lists.php.net to get a copy of this message
On 5/18/07, Haig Dedeyan <haig@x2omedia.com> wrote:
Sorry for the lack of information. I also was wrong about the subdirectory name. It's "Images" and not "Image" The workstation is running WinXP Pro while PHP 5 & Apache 2 are on Suse 10.1. I also installed apache2 & php5 on a WinXP Pro system and the same problem occurs. I have tried 7 workstations and they are all giving the same problem. Whether the subdirectory is "Images" or "images", it makes no difference, the problem is still there. Once I rename that "images" or "Images" directory, all is fine.
What are you trying to say here? It doesn't work with Images and images, but when you change it from images to Images it works? Clarify yourself please.
Here's the code: <?php $path = '//path to directory/'; $dir_handle = opendir($path) or die("Unable to open $path"); $paths = array(); while ($file = readdir($dir_handle)) {
    if(!is_dir($file))
    {
        $paths[] = "$path$file";
    }
} closedir($dir_handle); sort($paths); echo '<ul>'; $x="0"; foreach ($paths as $link) {
    $show = substr($link,strrpos($link, '/')+1);
    echo "<li><a href=
'file://$paths[$x]'>$show</a></li>\n";
        $x++;
} echo '</ul>'; ?>
Just did a quick look at your code, and it's quite strange what you have. First, you said you're script lists subdirectory's, but you're checking for everything that isn't a dir. So it's normal that your images subdirectory isn't listed. Second, why does your path start with // ? one is enough :) At last, why are you using file:// in your link? You're using a webserver to display the contents, but file:// links to files on the local hard drive. Unless the server is running on the same machine you're visiting the site with, it will fail to point to the right file. Tijnema ps. Please don't top post.
On 5/18/07, Tijnema ! <tijnema@gmail.com> wrote: On 5/18/07, Haig (Home) <hdedeyan@videotron.ca> wrote:
Hi everyone, I have a simple script that scans a directory and will output a
list of sub
directories as a hyperlink. Script is working fine. Only problem I have is that if there is a subdirectory called "Image", my script won't see it. If I rename
that
subdirectory to anything else, it will see it. If I use a standard href line to link that "image" subdirectory,
that's fine
but then it won't show up alphabetically when the other folders are
linked.
Any ideas? Haig
We can't guess what you did wrong, show us relevant parts of your code. Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
    I'm guessing that it's just a typo, but are "Image" (first mention)
and "image" (all lower-case, second mention) actually the exact same directory? Remember, all POSIX-based systems (*nix, Linux, BSD, MacOS) are all cAsE-sEnSiTiVe.
    Also, in addition to Tijnema's request, please supply your basic
server configuration (WIMP, LAMP, et cetera). For example:
        Linux (Redhat 7.1)
        Apache 1.3.37
        MySQL 3.23
        PHP 3.4.4
    Just *please* don't tell me you have that configuration!  ;-P
-- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107


« previous php.general (#255134) next »