tags:

views:

55

answers:

3

Is it possible to get the contents of a directory with javascript?

+6  A: 

Not really because of security reasons. You are trying to access client's file system !!

Note: There is FSO (File System Object) but to my knowledge it only works in IE.

Useful Resources:

http://www.c-point.com/JavaScript/articles/file_access_with_JavaScript.htm
http://4umi.com/web/javascript/fileread.php

Sarfraz
There are new ways to access the clients file system with the new spec. They're just rarely used.
Ben Shelock
IIRC - can't use the FSO from inside a web page to scan the local drives.
Rob Levine
@Rob: http://www.c-point.com/JavaScript/articles/file_access_with_JavaScript.htm
Sarfraz
+1  A: 

No, not with JavaScript that runs within a browser sandbox.

Justin Ethier
A: 

Assuming you mean JavaScript running inside a web browser, then no.

If you are running from somewhere else, (e.g. cscript.exe from a Windows command line, or ASP server side) then yes.

Which scenario are you referring to?

Rob Levine