Acces files from a specified Folder

$img_fold=”images/slideshow/banner/”;

<?php
        $i=0;
        $string =array();
        $filePath=$img_fold;  
        $dir = opendir($filePath);
        while ($file = readdir($dir)) {
           if (eregi(“\.png”,$file) || eregi(“\.jpg”,$file) || eregi(“\.gif”,$file) ) {
           $string[] = $file;
           }
        }
        while (sizeof($string) != 0){
            
          $img = array_pop($string);
          ?>
<li><img src=”<?php echo $filePath.$img; ?>” alt=”slide1″ title=”slide1″ id=”wows1_<?php echo $i; ?>”/></li>
<?php       $i=$i+1; }        ?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s