I\'m trying to embrace jQuery 100% with it\'s simple and elegant API but I\'ve run into an inconsistency between the API and straight-up HTML that I can\'t quite figure out.
I could not get IE8+ to work by adding a jQuery event handler to the file input type. I had to go old-school and add the the onchange="" attribute to the input tag:
function getFileName(elm) {
var fn = $(elm).val();
....
}
EDIT:
function getFileName(elm) {
var fn = $(elm).val();
var filename = fn.match(/[^\\/]*$/)[0]; // remove C:\fakename
alert(filename);
}