0

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!

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Airshow
0

Nevermind! Answered my own question...... Funny how that works.

Thanks Daniweb!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.