A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How to read a folder on the server?

  1. #1
    Senior Member
    Join Date
    Oct 2005
    Posts
    108

    How to read a folder on the server?

    I'd like to make a dynamic photo gallery that bypasses XML; so the website owner can just upload folders/images to a directory, and not bother updating an xml file.

    I think PHP could be one way to do this, is it the best? Could Flash do it without a serverside script, just AS?

    Basically, I would like the script (AS, PHP, whatever) to look in a directory, let's call it "gallery/". Any folders in that directory become categories in the gallery (drop-down or combo box or something is populated with the folder/category names). Any images in those folders are automatically made into thumbnails, and displayed when that category is selected. Can be a manual gallery, a slideshow, or whatever. I'll work on that later.

    Is PHP my best answer?

    Thanks!

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    PHP is a good solution.
    A simple script such as
    PHP Code:
    <?php
    //path to directory
    $directory './images/';
     
    //get all image files with a .jpg, .jpeg, .png or .gif extension
    $images glob("$directory{*.gif,*.jpg,*.jpeg,*.png}"GLOB_BRACE);

    // view the array with the images' names
    print_r($images);
    ?>
    does what you want.

    After having the images in an array, you can still generate an xml file dynamically.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center