Reputation: 43
How to get full path from html input file ? Like this C:/user/desktop/something.png But is's coming something.png or C:/fakepatch/something.png
Upvotes: 0
Views: 1120
Reputation: 14334
You cannot. This is a security measure implemented by the browser.
See https://www.w3.org/TR/html52/sec-forms.html#example-4aa6dac8
For historical reasons, the value IDL attribute prefixes the file name with the string "C:\fakepath\". Some legacy user agents actually included the full path (which was a security vulnerability).
If you were able to see the full path, you might be able to compromise the user's privacy. For example, it might leak their user name, full name, type of computer they're on, etc.
Upvotes: 1