IT改变世界  
看得见的未来
日历
<2010年12月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
统计
  • 随笔 - 12
  • 文章 - 2
  • 评论 - 1
  • 引用 - 0

导航

常用链接

留言簿

随笔分类

随笔档案

文章分类

文章档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜

 
在IE8中上传路径变成了C:\fakepath\*,主要原因是因为微软又体贴了用户一把,如何解决呢?
工具 -> Internet选项 -> 安全 -> 自定义级别 -> 找到“其他”中的“将本地文件上载至服务器时包含本地目录路径”,选中“启用”即可。
 <script type="text/javascript">
  function getPath(obj) {
  if (obj) {
  if (window.navigator.userAgent.indexOf("MSIE") >= 1) {
  obj.select(); return document.selection.createRange().text;
  }
  else if (window.navigator.userAgent.indexOf("Firefox") >= 1) {
  if (obj.files) {
  return obj.files.item(0).getAsDataURL();
  }
  return obj.value;
  }
  return obj.value;
  }
  }  

  //以下即为完整客户端路径
  var filepath=getPath(document.getElementById("iptfileupload"));
  </script>
posted on 2010-12-15 20:14 爱品者 阅读(108) 评论(0)  编辑  收藏 所属分类: JavaScrpit

只有注册用户登录后才能发表评论。


网站导航:
 
 
Copyright © 爱品者 Powered by: 博客园 模板提供:沪江博客