Skip to content Skip to sidebar Skip to footer

Activexobject("scripting.filesystemobject") Not Working For Me

I want to add names of files of a specific folder to an JS's array, but nothing happens: var pics = new Array(); var x; var fs = new ActiveXObject('Scripting.FileSystemObject'); a

Solution 1:

Assuming JScript + Classic ASP due to the MapPath (which you dont need in your case) you need to escape the path string;

var pics = [];
var fs = new ActiveXObject("Scripting.FileSystemObject");
var fo = new Enumerator(fs.GetFolder("C:\\wamp\\www\\newsite\\ErfanGhiasiPanel\\Slider Images").Files);

for (; !fo.atEnd(); fo.moveNext()) {
    pics.push(fo.item(0).Name)
}

Post a Comment for "Activexobject("scripting.filesystemobject") Not Working For Me"