简体   繁体   中英

how to get full path from fileupload using Javascript

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

这是浏览器安全限制,在现代浏览器中,您无法获得所选文件的完整客户端文件系统路径,也无法以编程方式设置路径...

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM