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)
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)
Share Improve this question edited Apr 11, 2010 at 22:00 Rella asked Apr 11, 2010 at 21:25 RellaRella 67.1k112 gold badges374 silver badges642 bronze badges 2- Do you want to get all files or all files that the page links to? – SLaks Commented Apr 11, 2010 at 21:31
- Is this on the server or on a local machine? – Sasha Chedygov Commented Apr 11, 2010 at 21:35
2 Answers
Reset to default 3Unless 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?
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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745037863a4607630.html
评论列表(0条)