直接上代码 记录一下
1
2
3
4
5
get file input full path6
7 function getFullPath(obj)
8 {
9 if(obj)
10 {
11 //ie
12 if (window.navigator.userAgent.indexOf("MSIE")>=1)
13 {
14 obj.select();
15 return document.selection.createRange().text;
16 }
17 //firefox
18 else if(window.navigator.userAgent.indexOf("Firefox")>=1)
19 {
20 if(obj.files)
21 {
22 return obj.files.item(0).getAsDataURL();
23 }
24 return obj.value;
25 }
26 return obj.value;
27 }
28 }
29
30
31
32
33
34
35
firefox7+请使用return window.URL.createObjectURL(obj.files.item(0));来获取地址
摘自 AhJesus