js 获取 input file 文件 附给 image src
var a=document.querySelector('input[type=file]');
a.onchange = function (e) {
//var reader = new FileReader();
//reader.readAsDataURL(a.files[0]);
//reader.onload = function (event) {
//img.src = event.target.result;
//};
var reader = new FileReader();
reader.readAsArrayBuffer(a.files[0]);
reader.onload = function (event) {
// blob stuff
var blob = new Blob([event.target.result]); // create blob...
window.URL = window.URL || window.webkitURL;
var blobURL = window.URL.createObjectURL(blob); // and get it's URL
var img=new Image();
img.src=blobUrl;
document.body.appendChild(img);
};
}
js 获取 input file 文件 附给 image src的更多相关文章
- js获取input file文件二进制码
<html> <body> <img id="image"src=""/> <br/> <input ty ...
- js 实现 input file 文件上传
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat=&qu ...
- js 获取input file路径改变图像地址
html代码 <img id="newImage" alt="100x100" src="__PUBLIC__/img/1.jpg" ...
- js获取input file路径改变图像地址
版权声明:好歹是我写的或者总结的或者抄的,总待给我个名份吧~ https://blog.csdn.net/sangjinchao/article/details/52250318 html代码 < ...
- js获取input file完整路径的方法
function getPath(){ //判断浏览器 var Sys = {}; var obj = document.getElementById("headImg"); ...
- js获取 input file 图片缩略图
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- js 获取input type="file" 选择的文件大小、文件名称、上次修改时间、类型等信息
文件名的传递 ---全路径获取 $('#file').change(function(){ $('#em').text($('#file').val()); }); 文件名的传递 ---只获取文件名 ...
- js获取上传文件内容(未完待续)
js 获取上传文件的字节数及内容 <div> 上传文件 : <input type="file" name = "file" id = &qu ...
- Atitit.js获取上传文件全路径
Atitit.js获取上传文件全路径 1. 默认的value只能获取文件名..安全原因.. 1 2. Firefox浏览器的读取 1 3. Html5 的file api 2 4. 解决方法::使用a ...
随机推荐
- 7 个基本的 JS 函数【译】
本文由 伯乐在线 - 刘健超-J.c 翻译,进林 校稿.未经许可,禁止转载!英文出处:davidwalsh.name.欢迎加入翻译组. 我记得早期的 JavaScript ,要完成任何事情几乎都绕不开 ...
- Nginx - Additional Modules, Website Access and Logging
The following set of modules allows you to configure how visitors access your website and the way yo ...
- AjaxForm
近乎的Ajax控件介绍,代码下载:http://www.jinhusns.com/Products/Download?type=whp AjaxForm 概述 功能说明 基于 ajaxForm 插件进 ...
- AngularJS 学习随笔(一)
AngularJS 初始化加载流程: 1:浏览器载入HTML,然后把它解析成DOM 2:浏览器载入Angular.JS 脚本 3:AngularJS 等到DOMContentLoaded时间触发 4: ...
- 使用 EF Power Tool Code Frist 生成 Mysql 实体
原文:使用 EF Power Tool Code Frist 生成 Mysql 实体 1,在要生成的项目上右键 2, 3, 4, 5, 生成后的效果 已知问题: 1,在Mys ...
- PHP学习笔记 - 进阶篇(8)
PHP学习笔记 - 进阶篇(8) 日期与时间 取得当前的Unix时间戳 UNIX 时间戳(英文叫做:timestamp)是 PHP 中关于时间与日期的一个很重要的概念,它表示从 1970年1月1日 0 ...
- C#中Excel的导入和导出的几种基本方式
在上一篇(http://www.cnblogs.com/fengchengjushi/p/3369386.html)介绍过,Excel也是数据持久化的一种实现方式.在C#中.我们常常会与Excel文件 ...
- oracle表分区心得
由于系统是对前批次系统进行改造,需要对表建立分区 1.已建立未分区的表,无法进行任何表分区的操作,如:增加.删除.合并.拆分均无法操作 2.已分区的表至少保留1个分区,即不能全删 3.若有defaul ...
- NodeJS V8 GC概览
[A tour of V8: Garbage Collection] http://jayconrod.com/posts/55/a-tour-of-v8-garbage-collection 基本是 ...
- Error LNK2001 无法解析的外部符号 的几种情况及解决办法
最近遇到的关于VS里编译出现的“无法解析的外部符号”问题,在网上寻求解决办=办法时查到下面的博客内容,作者讲解的挺全面的,作为收藏以备将来查询. 原文http://blog.csdn.net/shen ...