jquery: is there a way to read all files from the host directory?

373 views Asked by At

im just brainstorming an interface that dynamically generates a page based on files located in page's directory. I'm wondering if jquery can do this? For instance, a page just displays information for each file, maybe a thumbnail, etc. If i were to drop a new file into that directory, the page would show it.

2

There are 2 answers

1
Tae-Sung Shin On

Jquery is a library written in javascript that basically runs on client browser. So if you want to working with server (host), you need to communicate with server via Ajax or other techniques. Jquery, however, does not have an ability to read files in the server.

0
Michael Louis Thaler On

Pure client-side Javascript can't do this by design (it would be a serious security hole); it would need to be able to speak to the server. It would be possible to write a server-side app that can return the contents of the directory, which Javascript would be able to send AJAX GET requests to pull out and display.