I am using a custom file upload button in my web app. I want the user to see that they have chosen a file so I change the html of a div to show the file name.
Here is my jquery:
$("input[type=file]").change(function() {
var filename = $("input[type=file]").val();
$("#share-file-name p").html(filename);
});
Now, this works great, except for the fact that the value of the input is:
C:\fakepath\photo.jpg
So that's what the user sees. I just want them to see the "photo.jpg" part. How can I use my jquery to strip everything except for the file name?
Thanks!