本文分享下手机上传图片实时预览效果
淘建站为您提供更多_html5_上传文件_上传_预览,在此特别感谢您对我们的支持与厚爱!
演示不了,点击反馈
下载 476 次
26 积分
HTML
<input id="img" type="file" accept="image/*" />
<div id="photo"></div>jQuery
$(function() {
$('#img').change(function() {
var file = this.files[0];
var r = new FileReader();
r.readAsDataURL(file);
$(r).load(function() {
$('#photo').html('<img src="' + this.result + '" alt="" />');
})
})
})

