I need to show the name of the currently selected file (in <input type="file">
element).
Everything is fine, the only problem is I'm getting this kind of string "C:fakepath ypog_rules.pdf" (browset automatically puts this as value for the input element).
When I try to split the string by ''
or '\'
it fails because of unescaped slashes. Attempts to match/replace slashes fails too. Is there a way around this? I need this to work at least in Opera and IE (because in other browsers I can use FileReader)
E.G. I'm getting "C:fakepathypog_rules.pdf" as input and want to get "typog_rules.pdf" as output.
Question&Answers:os