File Names Into Array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • boarderstu@gmail.com

    File Names Into Array



    right so im in the midst of creating a gallery for a friend of mine, i
    have most of it right, but when i get the file names from the directory
    and into an array i have the ".." and "..." as the first two elements,
    any ideas?

    my getImages functions is simply as follows:

    #PHP

    function getImages()
    {
    global $images;
    $mydir = opendir(images) ;


    for($i=0; $i<10; $i++)
    {
    $entryname = readdir($mydir) ;
    $images[] = $entryname;
    echo("<br>");

    }
    #PHP

  • Geoff Berrow

    #2
    Re: File Names Into Array

    I noticed that Message-ID:
    <1108386773.836 989.142200@l41g 2000cwc.googleg roups.com> from
    boarderstu@gmai l.com contained the following:
    [color=blue]
    > for($i=0; $i<10; $i++)
    > {
    > $entryname = readdir($mydir) ;
    > $images[] = $entryname;
    > echo("<br>");[/color]


    Well I don't think that's the only problem with this function. The only
    thing it appears to output is line breaks.

    This snippet from one of my scripts might help.

    if ($dh = opendir($dir)) {
    while (($file = readdir($dh)) !== false) {
    if(($file!="."& &$file!=".." )){
    echo "<tr><td>filena me:&nbsp;</td><td><b> <a
    href=\"$file\"> $file</a></b></td><td>Type:&nb sp</td><td>". filetype($dir
    .. $file)."</td><td align=\"center\ "><input
    type=\"checkbox \"name=\"del ete[]\" value=\"$file\" ><td></tr>\n";
    }
    }
    closedir($dh);
    }
    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

    Comment

    Working...