By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,727 Members | 757 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,727 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <c7**************************@posting.google.com >,
ma***********@hotmail.com enlightened us with...
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

Jul 23 '05 #2

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

Matt

kaeli <ti******@NOSPAM.comcast.net> wrote in message news:<MP************************@nntp.lucent.com>. ..
In article <c7**************************@posting.google.com >,
ma***********@hotmail.com enlightened us with...
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.

--

Jul 23 '05 #3

P: n/a
In article <c7**************************@posting.google.com >,
ma***********@hotmail.com enlightened us with...
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

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.