list a directory with javascript

How do I return the filenames of all the files in a folder using javascript.
roscoeh23Asked:
Who is Participating?
 
contactkarthiConnect With a Mentor Commented:
i think you will not be able to do that with javascript..

what are you exactly trying to do?
0
 
vs1784Connect With a Mentor Commented:
Files from server or client?

From client you will need some activex installed at each clinet, you can do it using that. You can not list files without using any client side software, Windows security will not allow it.

For server files you can call some server script using AJAX and list them down.

Thanks,
0
 
LakioConnect With a Mentor Commented:
unless they are all named file1.txt to file100.txt
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
b0lsc0ttConnect With a Mentor IT ManagerCommented:
roscoeh23,

Where is the folder?  On the computer where the browser is or where the web page is?  What type of webpage (i.e. Internet, intranet, local)?

In general you can't use Javascript for this.  With Internet webpages this is especially true.  The Javascript can't search the web servers folder and browser security stops it from accessing folders on browser's computer.  With IE and ActiveX on a machine where the page is running locally then you could search the files in a folder.  In some cases the version of IE or security settings may stop this still and you will almost certainly have a "script" warning you will need to answer and allow.

If the files are on a web server and this is an Internet page then you should use a server language to do this (e.g. ASP, PHP, Perl).

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
b0lsc0ttIT ManagerCommented:
Please disregard the parts of my comment that repeats what vs1784 said.   I didn't mean to repeat him on ActiveX and the browser security.  All credit to him for anything I was just repeating but there is some extra I added that may help.

Even if the files are text files you won't be able to get the list of them if this is an Internet page and/or the files are on the web server.  The type won't make a difference for the security and access limitations we mentioned.

bol
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
 
mlivnehCommented:
comment well accepted
thank you
0
All Courses

From novice to tech pro — start learning today.