I want to get the file name of the uploaded file using jQuery. But the problem, I got the fake path and file name, instead of the file name only. This is my form.
<form action="" method="post">
<input type="file" name="uploadFile" id="uploadFile" />
<input type="submit" name="submit" value="Upload" id="inputSubmit" />
</form>
And the jQuery is like this
$(document).ready(function(){
$('#inputSubmit').click(function(){
alert($('#uploadFile').val());
});
});
I use Chrome and got this in the alert box. Let's say I choose file named filename.jpg.
C:\fakepath\filename.jpg
How can I get only the file name? Thank you for your help.