Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8910177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:37:19+00:00 2026-06-15T03:37:19+00:00

Reading up on scandir() , having an issue getting anything to display. <?php $dir

  • 0

Reading up on scandir(), having an issue getting anything to display.

<?php
    $dir = 'http://www.universaldynamicmedia.com/sandbox/Images';
    $array = scandir($dir);
    foreach($array as $key => $value)
        {
            echo '<li><img src="' . $dir . $value . '" /></li>';
        }
?>

I supposed I’m not doing something right with the directory and scandir() as the other stuff, I’ve done before and it works fine.

Would directory permissions cause an issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:37:20+00:00Added an answer on June 15, 2026 at 3:37 am

    ** Note you cannot use a URL, you must have access to the folders/files

    scandir():

    $dir = "PATH_TO_DIRECTORY";
    $exclude = array( ".","..","error_log","_notes" );
    if (is_dir($dir)) {
        $files = scandir($dir);
        foreach($files as $file){
            if(!in_array($file,$exclude)){
                echo '<li><img src="' . $dir . $file . '" /></li>';
            }
        }
    }
    

    readdir():

    $dir = "PATH_TO_DIRECTORY";
    $exclude = array( ".","..","error_log","_notes" );
    if (is_dir($dir)) {
        if ($dh = opendir($dir)) {
            while (($file = readdir($dh)) !== false) {
                if(!in_array($file,$exclude))
                     echo '<li><img src="' . $dir . $file . '" /></li>';
            }
            closedir($dh);
        }
    }?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading the article on http://www.jamesward.com/2011/08/23/war-less-java-web-apps on how to embed an app server with your
Reading the section Zend_Application_Resource_Modules in the docs here: http://framework.zend.com/manual/1.10/en/zend.application.available-resources.html I noticed this: You can
Reading this list of Chrome match patterns: http://code.google.com/chrome/extensions/match_patterns.html How do I specify a match
Reading manual about Sling http://sling.apache.org/site/46-line-blog.html added folder blog and blog.html to destination: \launchpad\content\src\main\resources\content\ but
Reading the Redis documentation on Virtual Memory at: http://redis.io/topics/virtual-memory With regards to vm-max-threads they
Reading PHP & jQuery Cookbook right now and it gives this example for using
reading this https://developers.google.com/in-app-payments/docs/tutorial Quoted from the above page: Because you sign the JWT using
Reading the design guidelines. I came across a little issue while trying to practice
Reading my own Feed in Facebook-API https://graph.facebook.com/me/feed with a valid Access-Token gives me the
Can someone please xplain this code. Im reading larry ullmans book on php and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.