I wanted to validate what file the user is trying to upload, the element ID of the input / button object is : fileToUpload
But, when trying the following code:
I get an error - undefined. So, I looked through the generated HTML code, and found out the reason - the input field itseld has another ID, this code works fine.... I just wasted a lot of time to figure it out. This can help someonevar selected = document.getElementById("fileToUpload");
var thepath = selected.value;
Cheersvar selected = document.getElementById("fileToUpload-file");
var thepath = selected.value;