Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts

    Showing All Images in A Directory

    Okay I want my photos.php file to show all the photos I have in my /kowphotos/ directory on my server. How do I go out having that done?

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,468
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    I'm not trying to be a "smart-alec", but I do want to show you how to
    save a ton of time ... asking questions on the forum takes a while to
    get an answer.

    Instead, use Google and ask the question like this:
    http://www.google.com/search?hl=en&q...=Google+Search

    You'll find several examples to show only images, or any filetype.

    If you use Google like that, with a "PHP" in front and some function or term to find,
    it will usually come up with actual PHP code examples.

    This is one of the best resources ... look at some examples they have:
    http://us.php.net/readdir



    .
    Last edited by mlseim; 08-11-2008 at 05:56 PM.

  • #3
    Regular Coder
    Join Date
    Jun 2008
    Posts
    682
    Thanks
    114
    Thanked 2 Times in 2 Posts
    Well I found this code :

    PHP Code:
    <?php
    print_r
    (scandir("images"));
    ?>
    And it gave me this error:

    Fatal error: Call to undefined function: scandir() in /home/content/y/a/n/yankeefaninkc/html/photos.php on line 4

    Why is that?

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,468
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    Maybe you don't have PHP5 ... But are running PHP4?

    They show an alternative method for PHP4:
    http://us.php.net/manual/en/function.scandir.php


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •