views:

278

answers:

2

How to find all files in directory? I have HTML page in some directory. Using JavaScript I want to get all existing files in some subdirectory ( get all file names or relative links to them, on a local machine)

+3  A: 

Unless you have your server setup/defaulted so that you can go to a index-less directory and be presented with a list of files and directories that reside in that directory then that information isn't public.

You might want to try writing a short server-side script to retrieve a list of the files in your directory and make an AJAX call to it?

Steve
+2  A: 

Javascript which runs at the client machine can't access the local disk file system due to security restrictions. Otherwise one would be able to upload files in a hidden form unaskingly using Javascript.

If you like to access the client's disk file system, then look for the solution in a different corner: an embedded client application which you serve up from your webpage, like an Applet, Webstart, Silverlight or something like that. If you like to access the server's disk file system, then look for the solution in the server side corner using the server side programming language like Java, PHP, etc, whatever your webserver is currently using/supporting.

BalusC
What about activex :)?
systempuntoout
@systempuntout: That's a poor MSIE proprietary JS library with too much freedom. It wouldn't work for the majority of the world wide web visitors because they have it disabled/restricted or use a better browser.
BalusC