兜里没糖_lyl 2015-08-16 03:20 采纳率: 0%
浏览 2635
已结题

往数据库上传excel表怎样通过js获取文件全路径

往数据库上传excel表怎样通过js获取文件全路径
function getFullPath(){
var filepath = getPath(document.getElementById("file"));
alert(filepath);
//var filepath=getPath(obj);
function getPath(obj)
{
if(obj)
{
//ie
if (window.navigator.userAgent.indexOf("MSIE")>=1)
{
obj.select();
alert(document.selection.createRange().text);
return document.selection.createRange().text;
}
//firefox
else if(window.navigator.userAgent.indexOf("Firefox")>=1)
{
if(obj.files)
{
alert(obj.files.item(0).getAsDataURL());
return obj.files.item(0).getAsDataURL();
}
alert(obj.value);
return obj.value;
}
return obj.value;
}
//alert(filepath);
}

    window.location.href="examiner/excelToDB.action?filepath="+filepath;
}

往数据库上传excel表怎样通过js获取文件全路径

  • 写回答

3条回答 默认 最新

  • devmiao 2015-08-16 07:27
    关注

    获取不了,js不能操作文件系统。上传带不带路径取决于浏览器。另外本地路径对于服务器也没有意义。

    评论

报告相同问题?