How to overwrite multiple files in a directory?

Using javascript to scan a local directory and display files in web browser?

  • 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!

  • Answer:

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

Weston at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

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.

John's Secret Identity™

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.

Stanley

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.