您的位置:首页 > 其它

上传文件 获取路径

2013-09-10 11:07 225 查看
<input name="fdxml" id="upload" type="file" />

1一开始获取C:\fakepath\doc.xml 实际路径:D:xml\doc.xml

设置浏览器获取到实际路径:interneter选项--安全-自定义级别—启用-将文件上传时包含本地路径

区分浏览器

if (obj) { var file_up = document.getElementById('upload');

//ie if (window.navigator.userAgent.indexOf("MSIE") >= 1) {

file_up.select();

var realpath = document.selection.createRange().text;

}

//firefox else if (window.navigator.userAgent.indexOf("Firefox") >= 1) {

if (file_up.files) {

return file_up.files.item(0).getAsDataURL();

} return file_up.value;

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: