English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How can I use javascript to scan a local directory and display the files in the browser as if it were really a directory listings page? I could manually make a directory listings page but I would like something that would automatically update itself when new files are added to the directory. I'm using a free web hosting service for a current project and would very much like the directory listings page but the host does not allow PHP. Please do not suggest other hosts or to manually make the page. If you can tell me how to use javascript to complete this task, please let me know. Thanks!

2006-09-23 13:27:45 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

Note: The directory listings would be for the webserver and not my computer. Also, my host does not automatically show the listings. Instead, a basic 404 page is displayed.

2006-09-23 13:37:08 · update #1

3 answers

There is no way to "read" a directory using javascript. You can't even read a file with javascript. I wish you could.

2006-09-23 13:40:00 · answer #1 · answered by Barkley Hound 7 · 0 0

javascript runs on the local client computer and not the web server, therefore will only be able to view local files. To view files on the web server, you need a server side script such as asp,php, asp.net etc. I don't think there is a way around this one. You can try to enable directory browsing for a folder, disable default pages (index.htm etc), then have a page in another folder show the contents of the browsible folder in a frame or iframe.

2006-09-23 21:14:01 · answer #2 · answered by Stanley 3 · 0 0

Do you mean a directory on the server? Just don't put an index.html file or anthing else that would be displayed by default, and make a link to the directory, ie: http://your.server.tld/filedirectory/

If you mean on the user's computer, there should be no way unless the browser has a security bug.

2006-09-23 20:33:51 · answer #3 · answered by John's Secret Identity™ 6 · 0 0

fedest.com, questions and answers