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
2010-06-17 16:50:13
There are new ways to access the clients file system with the new spec. They're just rarely used.
Ben Shelock
2010-06-17 16:52:24
IIRC - can't use the FSO from inside a web page to scan the local drives.
Rob Levine
2010-06-17 16:53:42
@Rob: http://www.c-point.com/JavaScript/articles/file_access_with_JavaScript.htm
Sarfraz
2010-06-17 16:58:26
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
2010-06-17 16:52:42