[英]how to get full path from fileupload using Javascript
I need to know how to get full path from fileupload using javascript,我需要知道如何使用 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.也许出于安全原因,javascript 不允许这种情况发生。 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尽管如此,只有当您可以在本地机器上运行 Electron 桌面应用程序时才会有所帮助: https : //stackoverflow.com/a/59990858/9390914
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.