Use JavaScript/ActiveX to get list of files

2019-09-19 07:24发布

问题:

I've been Googling for hours with no avail...!

How do I use the Scripting.FileSystem object?

In my current case, I want to fill a SELECT element with a list of folders from a particular location. Then, after selecting a folder, I want to display all images found within that folder.

Thanks

P.S. Security is not an issue.

回答1:

You can not use Scripting.FileSystem in web pages because of security reasons. In case you have enough permissions to create such object (HTA or no IE security), it can be used like:

var obj = new ActiveXObject("Scripting.FileSystem");