DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Listing the content of a folder into an array

  1. #1
    Join Date
    Sep 2005

    Red face Listing the content of a folder into an array

    I am trying to put in place a simple photo galley/slide show. I cannot figure out how to pull all the files from within a folder. I have a folder in my root called "photos" and would like to have some JavaScript retrieve all the files within this folder and drop them all into an array of this form

    var Slides = new Array('./photos/test1.jpg','./photos/test2.jpg','./photos/test3.jpg','./photos/test4.jpg');
    What I am looking to achieve is to be able to keep dropping photos into the photos folder without having to add files to the array.

    Your help will be fully appreciated, thank you.

  2. #2
    Join Date
    Dec 2004
    San Bernardino County, California
    I don't know enough JavaScript to help you with that.

    In Java, I would first try creating an ArrayList (since you indicate that you want this to be dynamic) of File objects. If that didn't work I'd have to move on from there.

  3. #3
    Join Date
    Nov 2004
    You can have a naming convention for the files, like you have here (test1, test2 ...)
    and have javascript making filenames and loading the files in a loop that breaks at
    first missing image file. You will then have to rename your image files to conform
    with the number sequence, as you store them in the image folder.
    eschew obfuscation

Similar Threads

  1. Displaying folder content in Detail mode
    By EllJay in forum Architecture and Design
    Replies: 0
    Last Post: 11-27-2001, 04:26 PM
  2. Public Folder content replication
    By Richard Rowe in forum Enterprise
    Replies: 0
    Last Post: 07-05-2001, 10:31 AM
  3. Unable to create public folder
    By precious in forum Enterprise
    Replies: 0
    Last Post: 06-21-2001, 08:22 AM
  4. Replies: 0
    Last Post: 03-14-2001, 03:03 PM
  5. Administering Exchange Public Folder
    By WL in forum Enterprise
    Replies: 0
    Last Post: 07-06-2000, 03:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center