Skip to content Skip to sidebar Skip to footer

Absolute Path To File On Input[type=file]

Is is possible to get the ABSOLUTE path to a file using javascript or jquery? These are my trials so far but the closest I can get is just the filename. var filepath = $('input

Solution 1:

No, that would be a security violation. (It could tell you the user's name, etc. i.e. c:\Users\Kirk\Desktop\uploadedfile.txt)

Out of curiosity, why do you desire this information?

Solution 2:

According to the specifications of HTML5, a file upload control should not reveal the real local path to the file you have selected, if you manipulate its value string with JavaScript. Instead, the string that is returned by the script, which handles the file information is c:\fakepath

Post a Comment for "Absolute Path To File On Input[type=file]"