list a directory with javascript

How do I return the filenames of all the files in a folder using javascript.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

i think you will not be able to do that with javascript..

what are you exactly trying to do?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Files from server or client?

From client you will need some activex installed at each clinet, you can do it using that. You can not list files without using any client side software, Windows security will not allow it.

For server files you can call some server script using AJAX and list them down.

unless they are all named file1.txt to file100.txt
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

b0lsc0ttIT ManagerCommented:

Where is the folder?  On the computer where the browser is or where the web page is?  What type of webpage (i.e. Internet, intranet, local)?

In general you can't use Javascript for this.  With Internet webpages this is especially true.  The Javascript can't search the web servers folder and browser security stops it from accessing folders on browser's computer.  With IE and ActiveX on a machine where the page is running locally then you could search the files in a folder.  In some cases the version of IE or security settings may stop this still and you will almost certainly have a "script" warning you will need to answer and allow.

If the files are on a web server and this is an Internet page then you should use a server language to do this (e.g. ASP, PHP, Perl).

Let me know if you have any questions or need more information.

b0lsc0ttIT ManagerCommented:
Please disregard the parts of my comment that repeats what vs1784 said.   I didn't mean to repeat him on ActiveX and the browser security.  All credit to him for anything I was just repeating but there is some extra I added that may help.

Even if the files are text files you won't be able to get the list of them if this is an Internet page and/or the files are on the web server.  The type won't make a difference for the security and access limitations we mentioned.

Forced accept.

EE Admin
comment well accepted
thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.