Record the Code directly.
1 <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 3 4 <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
5 <title> get file input full path </title>
6 <script language = 'javascript '>
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 </script>
30 31 <body>
32 <input type = "file" onchange = "document. getElementById ('img '). src = getFullPath (this);"/>
33
34 </body>
35
For firefox7 +, use return window. URL. createObjectURL (obj. files. item (0); to obtain the address
From AhJesus