Avatar of NAKBrooks
NAKBrooks
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Enabling user to choose image from webserver folder to display

I have a large number of archived images in a public folder on the web server. I want the user to be able to browse a list of the image files by filename and select one to be displayed.  This needs to be done using client-side JavaScript code only (no server-side code).

Basically I want to be able to populate a SELECT tag with the filenames of all files in the webserver folder.

What is the easiest way to do this?

Thanks
Web Languages and StandardsScripting LanguagesJavaScript

Avatar of undefined
Last Comment
NAKBrooks

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
mankowitz

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
NAKBrooks

ASKER
Thanks, I understand the security concerns but was assuming that as I can browse the folder concerned by putting the URL in the web browser (it is in a public area of the web site) it should be possible to read the contents of the index somehow and parse it to get an array of filenames using only client-side code.  If not I'll have to try and get php enabled on the server.
mankowitz

You might be able to do it if you are running apache and you have autoindex turned on. What happens when you browse to the directory that contains the images?
NAKBrooks

ASKER
It displays the directory. I think I can get php enabled so I'll accept your php snippet as a solution and build on that. Thanks.
Your help has saved me hundreds of hours of internet surfing.
fblack61