用document.getElementById("file").value;只能得到图片名
怎么才能得到完全路径
请各位高手指教~~

解决方案 »

  1.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title><script type="text/javascript" >
    function erew()
    {
    alert(document.getElementById("fies").value);
    }
    </script></head>
    <body>      
      <input  type="file" id="fies" />
      <input  type="button"  value="rtest" id="rest"  onclick="erew()"/>
    </body>
    </html>
      

  2.   

    参考下吧
    http://www.y7l8.com/2009/06/07/firefox-%E5%A4%9A%E6%B5%8F%E8%A7%88%E5%99%A8-%E4%B8%8A%E4%BC%A0%E5%9B%BE%E7%89%87-%E6%9C%AC%E5%9C%B0%E9%A2%84%E8%A7%88.htmlhttp://www.foolbirds.com/image-upload-preview.html
      

  3.   

    不同浏览器,同样的代码会得到不完整,不一样的路径,所以一般在后台这样写
    userPostedFile.SaveAs(filepath + "\\" + System.IO.Path.GetFileName(userPostedFile.FileName));
    js就不知道是不是有通用的方法了