Home  >  Article  >  Web Front-end  >  读取input:file的路径并显示本地图片的方法_javascript技巧

读取input:file的路径并显示本地图片的方法_javascript技巧

WBOY
WBOYOriginal
2016-05-16 17:21:381303browse
复制代码 代码如下:





Image preview example















但是需要注意的是 在IE8中 由于IE8自作聪明的将真实路径隐藏起来了 用alert打印的结果是C:/fakepath/*.jpg 所以导致该方法无法使用

解决办法是:进入工具 -> Internet选项 -> 安全 -> 自定义级别 -> 找到“其他”中的“将本地文件上载至服务器时包含本地目录路径”,选中“启用”即可。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn