Category Archives: did_you_know

did you know? (category auto created by Wordpresser)

Did you know? You can NOT retrieve an input type file true path

Did you know? You can NOT retrieve an input type file true path

Did you know? In modern HTML/JS code, you can NOT retrieve the true full path of a selected file, via the "value" attribute of an input of type "file".

So, if you wrote this EXAMPLE.HTML text file, saved it, loaded it on a browser, the output would be "c:\fakepath\your file" upon click, after any file selection.

<input type="file" id="idFile">
<input type="button" id="idButton" value="what is the selected path?">
<script>
document.getElementById("idButton").onclick = function(){
alert(document.getElementById("idFile").value);
}
</script>