javascript - How to get file name when user select a file via <input type="file" />? -


I have seen similar questions before, which is not solved for security reasons.

But today when I open a ticket and attach a file to my backend, then Hostnoster has successfully implemented it.

It works with both Firefox and IE (version 8 is accurate).

I have verified it exactly the client side scripting, no request has been sent (with firebug).

Now, can we reconsider this question?

You can get the filename , but you can get the full client file- System path can not be found. Try accessing the value attribute on input on

change events.

Most browsers will give you only filename , but there are exceptions like IE8 which will give you the duplicate path: "C: \" Fakepath \ myfile.ext " and the older version ( IE = 6 ) that actually wil I give you the full client file-system path (due to lack of security).

  document.getElementById ('fileInput'). Onchange = function () {Warning ('Selected File:' + This.value); };  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -