Ie8 native image upload preview sample code

  • 2020-03-30 01:19:55
  • OfStack

 
imgpath= getRealPath(fileId) ;  

document.getElementById("divSBTP").style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src=""+ imgpath + "")";//Use the filter effect

function getRealPath(fileId){ 

var file_upl = document.getElementById(fileId); 

file_upl.select(); 

return document.selection.createRange().text; 
} 

Note: ie8 local image upload preview can not directly use $(" #img "). Attr (" SRC ",imapath), because the browser is restricted to visit the local file, so the use of filters and div, if the filter and img will appear broken logo.

Related articles: