Does anyone know if i can write a generic javascript function that check the file extension
of the uploaded files and if the extension is incorrect erases the value
because the user upload's more then one file i want to get the ID from the form
something like:
fileselectedchange(obj)
{
var fileEXT = obj.substring(obj.indexOf('.')+1, obj.length);
if (fileEXT.toUpperCase() != 'XLS'){
alert('Please Select Only XLS File');
/* erasing the file input text geting the name from "obj" */
/* something like document.getelemntbyname(obj.name).value = "";*/
return;
}
}
<input type="file" name="firstXLS" onchange="fileselectedchange(this);" />
sorry if my english is not the best
thank you