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
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:
- What Is Best Free Web Browser For S60v5?Best solution by Yahoo! Answers
- How to search directory for specific files?Best solution by Stack Overflow
- How do I remove a site from IIS7 using JavaScript?Best solution by Server Fault
- How to connect to a Pervasive Database using javascript?Best solution by Stack Overflow
- How to write temporary files from temporary path to a temporary directory?Best solution by msdn.microsoft.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.