7

I need to know how to get full path from fileupload using javascript,

I tried using the following coding but of no use

<input type="file" id="picField" onchange="preview(this)">

<script type="text/javascript">

function preview(test){
    var source=test.value;
    alert(source);
}
</script>

but in the alert message, i am getting only

Filename.extension

I am not getting full path, but it is showing full path in File Upload box please help how to solve this problem

Thanks

3 Answers 3

4

This is a browser security restriction, in modern browsers you cannot get the full client file-system path of the selected file, nor set a path programmatically...

Sign up to request clarification or add additional context in comments.

1 Comment

A: the browser knows, and he passes the file itself without letting you know the real path
0

Maybe for security reason, javascript doesn't allow this to happen. And if you come to think of it, Server side pages cannot access your local files. Not that I have a solution for your question.

Comments

0

Actually, there is some kind of solution.
Albeit, it will help only if you can run Electron desktop app on local machine: https://stackoverflow.com/a/59990858/9390914

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.