js/jq input file获取本地文件路径 将要上传图片显示到页面
来源:互联网 发布:企业名录查询软件 编辑:程序博客网 时间:2024/04/29 22:52
<div class="ge_pic_icon_Infor"><img src="images/moren.jpg"/></div><div class="Infor_file"><input type="file" name="uploadPicture" id="file" value="" title="上传照片" onchange="getPhoto(this)"/></div>
<script type="text/javascript"> var imgurl = ""; function getPhoto(node) { var imgURL = ""; try{ var file = null; if(node.files && node.files[0] ){ file = node.files[0]; }else if(node.files && node.files.item(0)) { file = node.files.item(0); } //Firefox 因安全性问题已无法直接通过input[file].value 获取完整的文件路径 try{ imgURL = file.getAsDataURL(); }catch(e){ imgRUL = window.URL.createObjectURL(file); } }catch(e){ if (node.files && node.files[0]) { var reader = new FileReader(); reader.onload = function (e) { imgURL = e.target.result; }; reader.readAsDataURL(node.files[0]); } } creatImg(imgRUL); return imgURL; } function creatImg(imgRUL){ var textHtml = "<img src='"+imgRUL+"'width='414px' height='600px'/>"; $(".ge_pic_icon_Infor").html(textHtml); }</script>
input file 点击上传按钮 选择一张本地图片 显示到img里
http://blog.csdn.net/niyingxunzong/article/details/16989947
0 0
- js/jq input file获取本地文件路径 将要上传图片显示到页面
- 如何用一张图片代替 'input:file' 上传本地文件??
- js/jquery 获取本地文件的文件路劲 获取input框中type=‘file’ 中的文件路径
- js/jquery 获取本地文件的文件路劲 获取input框中type=‘file’ 中的文件路径
- 获取上传文件的路径input file
- 使用input file 上传图片并显示
- JS input file图片上传预览效果
- Js 获取本地文件路径
- <input type='file' />选择图片不上传,在页面中显示的功能。
- input file上传图片
- input file上传图片
- 获取input file 路径
- js获取input上传图片的尺寸
- JS获取input[file]的值并显示在页面的方法
- js判断input file上传文件路径是否正确
- js file上传图片并显示出来
- <input type="file">更改 页面显示 浏览 为上传 .
- 读取input:file的路径并显示本地的图片
- /etc/crontab和crontab -e的区别
- Undefined symbols for architecture x86_64
- Centos 安装python MySQL 模块 -- MySQLdb
- Mysql的row_format(fixed与dynamic)
- 如何使用Firebase创建Android聊天应用程序
- js/jq input file获取本地文件路径 将要上传图片显示到页面
- ASP.NET代码分页
- 隔行取数据
- ZooKeeper系列3:ZooKeeper命令、命令行工具及简单操作
- Maven学习 二
- 11.Spring学习笔记_通过工厂方法配置Bean(by尚硅谷_佟刚)
- IOS OC Navigation 导航条动态隐藏
- Linux下chkconfig命令详解
- sprintf