js给action传真是地址的时候,处于安全,传到action中 浏览器会改变路径变为C:\fakepath\ftp.txt,但是原始路径却是

C:\Documents and Settings\Administrator\桌面\ftp.txt

下面就是获得原始路径的方法

var url = getPath(document.getElementByIdx_x("url"))

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;
 }
}

相关文章:

  • 2021-07-24
  • 2021-09-23
  • 2022-12-23
  • 2021-05-16
  • 2022-12-23
  • 2021-10-04
  • 2022-02-21
猜你喜欢
  • 2021-06-10
  • 2022-12-23
  • 2021-11-07
  • 2022-12-23
相关资源
相似解决方案