首页 > 代码库 > 图片上传前/时预览

图片上传前/时预览

if (fileInputObj.files && fileInputObj.files[0])
{
var reader = new FileReader();
reader.onload = function(evt){
prevDiv.innerHTML = ‘<div id="flowChart"><img src="http://www.mamicode.com/‘ + evt.target.result + ‘" /></div>‘;
}
reader.readAsDataURL(fileInputObj.files[0]);
} else {
//prevDiv.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
//prevDiv.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = http://www.mamicode.com/fileInputObj.value;
prevDiv.innerHTML = ‘<div id="flowChart" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=http://www.mamicode.com/‘‘ + fileInputObj.value + ‘/‘"></div>‘;
}


来自为知笔记(Wiz)


图片上传前/时预览