Hey everyone,
I have been receiving an error that states that one of my variables ("$fileAmount") is undefined. I was hoping you guys might see something in my code where I am making a mistake. Please note that this is not the entire code, but where the error is occurring. "Browser" is a file browser used for uploading files. It errors on the third line of the function saying that $fileAmount is undefined.
var fileAmount=0;
function checkExtension()
{
if(document.getElementById("browser" + $fileAmount).value != '')
{
var fileName1 = document.getElementById("browser" + $fileAmount).value;
fileName1 = fileName1.substring(fileName1.lastIndexOf('\\') + 1);
var fileExt = fileName1.substring(fileName1.lastIndexOf('.') + 1);
if ((fileExt == 'txt'))
{
$fileAmount++;
return;
}
else
{
alert("Use valid file type");
document.getElementById("browser" + $fileAmount).focus();
return false;
}
}
}
Thank you all for your help!