note 102468 rejected from function.opendir by danbrown

From: Date: Wed, 16 Feb 2011 17:09:51 +0000
Subject: note 102468 rejected from function.opendir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-177040@lists.php.net to get a copy of this message
Note Submitter: Allenc at rdsinvestments dot com dot com ---- 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>'; ?>

« previous php.notes (#177040) next »