本文介绍了如何使用Javascript从文件上传获取完整路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要知道如何使用 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
谢谢
推荐答案
这是浏览器安全限制,在现代浏览器中,您无法获取所选文件的完整客户端文件系统路径,也无法以编程方式设置路径...
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...
这篇关于如何使用Javascript从文件上传获取完整路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!