Populating a drop-down box from the names of text files in a folder

M

Matt Davidson

Hi there,
I'm pretty new at JavaScript and I'm wondering if it is possible to
dynamically fill up a drop-down box (on a html form) with the names of
all of the .txt files which are stored in a particular folder.

I am aware that JavaScript has restricted file operations for security
reasons and so it may not be possible to do this.

If anybody is aware of how to do this or knows if it cannot be done,
any clues on how to approach this would be greatly appreciated.

Thankyou

Matt
 
K

kaeli

Hi there,
I'm pretty new at JavaScript and I'm wondering if it is possible to
dynamically fill up a drop-down box (on a html form) with the names of
all of the .txt files which are stored in a particular folder.

I am aware that JavaScript has restricted file operations for security
reasons and so it may not be possible to do this.

If anybody is aware of how to do this or knows if it cannot be done,
any clues on how to approach this would be greatly appreciated.

If and how can't be answered until we know if the script is accessing
files on the server or the client.

Which way do you want it? Javascript on the client, looking at client
files? That can only be done (AFAIK) with an HTA, which requires windows
and MSIE. Or do you want Javascript to access files on the server? That
can be done a few different ways to work around the client/server issue,
but it most efficiently done with a server-side script.

--
--
~kaeli~
Murphy's Law #2000: If enough data is collected, anything
may be proven by statistical methods.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
M

Matt Davidson

Thanks for your post,
I'm sorry I forgot to specify, It will be to read files from the server.

Matt
 
K

kaeli

Thanks for your post,
I'm sorry I forgot to specify, It will be to read files from the server.

Do you have ANY server-side scripting capabilities?
Even a cgi-bin for perl? Or SSI?

I have a javascript code snippet that will fill a select element dynamically
using a cgi script. Only works in DOM browsers, though.

If you have no server-side scripting at all, you'll need to have something
that runs on the server to get that list into a text file so javascript can
include it. Or you'd need a java applet, which can read files from the server
and talk to javascript.

If you're using only MSIE, we might be able to use a COM or ActiveX, too. I'd
have to check into it, but I'm pretty sure you're not the first to want this,
so someone probably has written one already.

--
--
~kaeli~
Punctuation, capitalization, and grammar are your friends,
and will help people think that you aren't such an ignorant
moron, after all.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top