0
I tried to use this function:
function getCount(foldername)
{
var myObject, f, filesCount;
myObject = new ActiveXObject("Scripting.FileSystemObject");
f = myObject.GetFolder(foldername);
filesCount = f.files.Count;
document.write("The number of files in this folder is: " + filesCount);
}
However, I get the error: Uncaught Referenceerror: Activexobject is not defined
Does anyone know an effective way to get the total number of image files from a folder with Javascript/Jquery
? To make it easier, it can be counting everything in the folder, because there is no possibility of another file type other than image.
In which browser are you trying to run this?
– bfavaretto
Error occurs in Chrome.
– Lollipop
I will venture to say that not because Javascript is a client side language, these images you want to count will be on the server (although while you are developing it is in a folder on the computer). Maybe it’s possible with
ajax
, maybe...– Renan Gomes
Because it is...I realized that Ajax would be the correct option since it can perform request for a beckend code, but how would this interaction?
– Lollipop
http://answall.com/questions/493/retornar-array-com-nome-de-todos-os-arquivos-em-diret%C3%B3rio
– M8n
Activex is a proprietary framework and works (badly) only in Internet Explorer. Stay away from it.
– rodorgas