I try to get the upload value when the input field
's change event
occurs
But I get this value on Chrome,
C:\fakepath\winnie-the-pooh.jpg
So I split the \
and the the last item in the array.
jquery,
$("#upload").change(function(){
var fragment = $("#upload").val();
var array_fragment = fragment.split('\/');
alert($(array_fragment).last()[0]);
});
But I still get C:\fakepath\winnie-the-pooh.jpg
instead of winnie-the-pooh.jpg
on Chrome.
How can I make it worked?
the html,
<input type="file" name="image" id="upload"/>