note 102468 added to function.opendir

[email protected] Wed, 16 Feb 2011 09:08:11 -0800
Newsgroups php.notes
Message-ID <[email protected]>
I have a script that will ope a directory and list its contents with a link. If I am using it to call up mainly word docs and docx is there a way to have the browser render the links rather than offer a download????

<?php 
            $uploads = wp_upload_dir();
 
                        if ($dir = opendir($uploads['basedir'].'/releases')) {
                                    $releases = array();
                           while (false !== ($file = readdir($dir))) {
                        if ($file != "." && $file != "..") {
                                    $releases[] = $file; 
                        }
            }
                        closedir($dir);
}
 
 
echo '<ul>';
foreach($releases as $releases) {
            echo '<li><a href="';
            echo $uploads['baseurl'].'/releases/'.$releases;
            echo '" title="' . $releases . '">';
            echo $releases;
            echo '</a></li>';
}
echo '</ul>';
?>
----
Server IP: 69.147.83.197
Probable Submitter: 207.191.63.26
----
Manual Page -- http://www.php.net/manual/en/function.opendir.php
Edit        -- https://master.php.net/note/edit/102468
Del: integrated  -- https://master.php.net/note/delete/102468/integrated
Del: useless     -- https://master.php.net/note/delete/102468/useless
Del: bad code    -- https://master.php.net/note/delete/102468/bad+code
Del: spam        -- https://master.php.net/note/delete/102468/spam
Del: non-english -- https://master.php.net/note/delete/102468/non-english
Del: in docs     -- https://master.php.net/note/delete/102468/in+docs
Del: other reasons-- https://master.php.net/note/delete/102468
Reject      -- https://master.php.net/note/reject/102468
Search      -- https://master.php.net/manage/user-notes.php