October 19, 2000 - Constructing A File Object
October 19, 2000 Constructing A File Object Tips: October 2000
Yehuda Shiran, Ph.D.
|
ActiveXObject()
with a single argument, Scripting.FileSystemObject
:
myActiveXObject = new ActiveXObject("Scripting.FileSystemObject");
You can create a File object by using the ActiveX's GetFile()
method:
file = myActiveXObject.GetFile("c:\\command.com");
The File object supports various properties and methods. The following code shows how to use the name
property:
alert("The name of the file is: " + file.name);
We don't show a live demo here, as for security reasons you cannot access the client file system from a server-based file.
Learn more about ActiveX controls in Column 55, OLE Automation in JavaScript.