上传文件 获取路径
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;
}
}
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;
}
}
相关文章推荐
- JavaScript 获取上传文件的本地绝对路径
- java如何获取jsp页面上传的文件路径 20 前台jsp: <form action="AA.do?method=yktAdd" method="post" > <input type='text'
- 关于js获取上传文件的完整路径问题?
- js获取文件上传路径(解决出现fakepath的问题)
- <input type="file">定义样式并获取上传文件路径及指定文件类型
- spring mvc怎么获取上传文件的原路径
- java web获取上传的文件在服务器端的路径
- <input type="file">定义样式并获取上传文件路径及指定文件类型
- 上传控件获取的文件路径不对
- phpcms v9多文件上传字段获取文件url路径地址的方法
- IE8上传文件时获取文件本地路径问题(C:\fakepath\……)的解决办法
- 上传控件获取的文件路径不对
- JS获取上传文件的绝对路径,兼容IE和FF
- springMVC 获取本地项目路径 及后整理上传文件的方法
- Selenium自动化,上传文件获取本地路径的问题
- IE7,IE8,上传文件控件input file和asp.net FileUpload控件无法获取完整路径的解决办法
- asp.net 客户端上传文件全路径获取方法
- JS获取IE上传文件路径、后缀、大小、文件名代码
- jsp 简化获取相对路径,Uploader文件上传
- action中通过javascript获取jsp页面中的文件上传路径