var filename = $('input[type=file]').val().split('\\').pop();
or you could just do (because it’s always C:\fakepath
that is added for security reasons):
var filename = $('input[type=file]').val().replace(/C:\\fakepath\\/i, '')
var filename = $('input[type=file]').val().split('\\').pop();
or you could just do (because it’s always C:\fakepath
that is added for security reasons):
var filename = $('input[type=file]').val().replace(/C:\\fakepath\\/i, '')