站点图标 起风网

文件上传C:\fakepath\解决方案

文件上传C:\fakepath\解决方案缩略图

1.设置IE:工具 -> Internet选项 -> 安全 -> 自定义级别 -> 找到“其他”中的“将本地文件上载至服务器时包含本地目录路径”,选中“启用”即可

2.利用js代码:

function getFilePath(input){      if(input){//input是<input type="file">Dom对象          if(window.navigator.userAgent.indexOf("MSIE")>=1){  //如果是IE                input.select(); 
       input.blur();
return document.selection.createRange().text; } else if(window.navigator.userAgent.indexOf("Firefox")>=1){ //如果是火狐 { if(input.files){ return input.files.item(0).getAsDataURL(); } return input.value; } return input.value; } }

 

参考:http://blog.csdn.net/panzuhong234234/article/details/51198843

      https://www.zhihu.com/question/31728280

文章转载于:https://www.cnblogs.com/lm970585581/p/8259365.html

原著是一个有趣的人,若有侵权,请通知删除

退出移动版