我有预览图像并获取图像名称的代码:
$("input[type=file]").on("change", function() {
$("[for=file]").html(this.files[0].name);
$("#preview").attr("src", URL.createObjectURL(this.files[0]));
})
但是我想获取图像的本地 url。例如,我从 D:/pic.jpg
选择图像,我想显示该文件路径。我怎样才能做到这一点?请帮我。
最佳答案
No modern browser allow you to get the exact local path of a file. The information your are looking for is limited by the security policy of the browser.
关于javascript - jquery/Javascript中浏览图片时如何从本地磁盘获取本地url图片路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34351974/