javascript - How to resolve the C:\fakepath? -


<input type="file" id="file-id" name="file_name" onchange="theimage();"> 

this upload button.

<input type="text" name="file_path" id="file-path"> 

this text field have show full path of file.

function theimage(){  var filename = document.getelementbyid('file-id').value;  document.getelementbyid('file-path').value = filename;  alert(filename); } 

this javascript solve problem. in alert value gives me

c:\fakepath\test.csv  

and mozilla gives me:

test.csv 

but want local fully qualified file path. how resolve issue?

if due browser security issue should alternate way this?

some browsers have security feature prevents javascript knowing file's local full path. makes sense - client, don't want server know local machine's filesystem. nice if browsers did this.


Comments