美文网首页
js获取fileinput中得路径

js获取fileinput中得路径

作者: yundGo | 来源:发表于2016-11-20 20:32 被阅读0次
var url; 
if (navigator.userAgent.indexOf("MSIE")>=1) { // IE 
    url = document.getElementById("img_input").value; 
} else if(navigator.userAgent.indexOf("Firefox")>0) { // Firefox 
    url = window.URL.createObjectURL(document.getElementById("img_input").files.item(0)); 
} else if(navigator.userAgent.indexOf("Chrome")>0) { // Chrome 
    url = window.URL.createObjectURL(document.getElementById("img_input").files.item(0)); 
}

相关文章

网友评论

      本文标题:js获取fileinput中得路径

      本文链接:https://www.haomeiwen.com/subject/kayypttx.html