如何从FileReader()获取路径目录? [英] How to get path directory from FileReader()?
本文介绍了如何从FileReader()获取路径目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码可以读取用户上传的文件:
Hi i have these codes to read the file the user has uploaded:
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$('#myImg').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
输出是整个数据块:
有什么方法可以从数据中获取路径吗?例如C:\Users\blackLeather\Desktop
Is there any way i can get the path from the data? for example C:\Users\blackLeather\Desktop
如果没有,是否有另一种方法来获取图像目录而不必添加到另一个文件夹中?
If no,is there another way to get the image directory without having to add into another folder?
推荐答案
有什么方法可以从数据中获取路径吗?
Is there any way i can get the path from the data?
不.一个都没有.出于安全原因,浏览器不会将该信息提供给JavaScript层.
No. None at all. That information is not provided to the JavaScript layer by the browser, for security reasons.
这篇关于如何从FileReader()获取路径目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文