how to get full path from fileupload using Javascript
Asked Answered
I

3

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

Inflationism answered 28/10, 2009 at 5:24 Comment(0)
B
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...

Boucicault answered 28/10, 2009 at 5:30 Comment(1)
A: the browser knows, and he passes the file itself without letting you know the real pathInvite
F
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.

Friend answered 28/10, 2009 at 5:28 Comment(0)
K
0

Actually, there is some kind of solution.
Albeit, it will help only if you can run Electron desktop app on local machine: https://mcmap.net/q/102412/-unable-to-get-full-path-of-file-dropped-in-browser-due-to-security-reasons-what-to-do

Kittie answered 30/1, 2020 at 17:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.