部分html代码
jq代码
$(function(){
var imgurl=[];
function createfile(){
$('#upp').append("");
}
function showimg(url){
var img='
';
$('#imglist').append(img);
}
function addfile(){
showimg($(this).val());
$(this).hide();
createfile();
$('.upfile').bind('change',addfile);
}
$('.upfile').bind('change',addfile);
})
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
目前我在内部项目中是这样使用的
建议题主阅读下面的文章来获取解决方案;
jquery实现上传图片本地预览效果
用JQuery获取File input里面的数据
应该有相关的jquey插件
FileReader API
http://jsfiddle.net/tjqsL5oL/
如果你要考虑兼容的话,可以考虑下百度的 http://fex.baidu.com/webuploader/ 已经做了封装了,对于不支持的则用了flash 但是接口保持一致