1
  • There are few images stored in a folder with random names.

  • The contents of the folder will constantly be changing but they will have only images and no other kind of documents.

  • Therefore i cannot predefine the image names in src.

  • I want to display the images sequentially (one after another with specific time interval) using HTML-Javascript-CSS codes.

  • The folder is on the client side only.

  • Or atleast i should be able to read the filenames in the folder.

    I cannot use PHP. How do i do this?

Thank you in advance!

Community
  • 1
  • 1
Rama
  • 1,019
  • 1
  • 15
  • 34
  • 1
    BTW: This has been asked [more](http://stackoverflow.com/questions/6994212/is-there-a-way-to-return-a-list-of-all-the-image-file-names-from-a-folder-using) [than](http://stackoverflow.com/questions/3087502/foreach-file-in-directory-jquery) [once](http://stackoverflow.com/questions/8031951/getting-images-from-folder-with-for-jquery-slideshow). – Mathias Jul 24 '14 at 09:41
  • 1
    If you know your users will be using IE and you're willing to compromise in many other ways (including user acceptance) then I think HTML Applications (.hta) are allowed local filesystem access. – Klors Jul 24 '14 at 09:46

1 Answers1

2

I think this is not trivially possible for security reasons. No webpage (even locally) is allowed to simply read your folder content. There have been some workarounds for some browsers, but I don't think there is a true Cross-Browser solution.

That said, there is the HTML5 file API that allows the user to select the images or drag and drop them to a local website.

Another option would be to have a small executable file that creates for instance a json List of your files and have the website read the filenames from there.

After you have the filenames, use any HTML/JS/CSS gallery.

Mathias
  • 1,470
  • 10
  • 20