<input type="file" size="22" id="upload" class="form-file" accept="png,gif,jpg,jpeg" name="bimg">我写的代码只能得到文件名,不能得到上传时候的本地路径。比如 C:\Documents and Settings\Administrator\My Documents\Downloads\Breadcrumb_error.jpg $('input[type=file]').change(function(){
   $('#demo').html($(this).val()); //只能得到Breadcrumb_error.jpg  而我想得到全部路径 C:\.......
});
谢谢

解决方案 »

  1.   

    IE下//判断浏览器类型
        var isIE = (document.all) ? true : false;
        var isIE7 = isIE && (navigator.userAgent.indexOf('MSIE 7.0') != -1);
        var isIE8 = isIE && (navigator.userAgent.indexOf('MSIE 8.0') != -1);    var file=document.getElementById("fileupload1");
        if(isIE7 || isIE8)
        {
            file.select();
            var path=document.selection.createRange().text;
            document.selection.empty();
        }
      

  2.   

    jquery目前貌似已经不能再获取到那样的路径了,浏览器更改了,想问下,你想干什么?
      

  3.   


    var f = document.getElementById("upload");
    alert(f.value);
    jquery不能获得了
      

  4.   

    ff下的方法被我给弄丢了,不过就算不丢这些也没什么用了,以下是ie里的
    <script language="javascript">
    function preview(fileObj, id){
    fileObj.document.execCommand("SelectAll");
    var filePath = document.selection.createRange().text;
    alert(filePath);
    }</script><img id="img" style="display:none">
    <input type="file" id="file" name="file" onchange="preview(this, 'img')">
      

  5.   

    http://hi.baidu.com/ypxmaomao/blog/item/83dee50a800ef91694ca6b51.html火狐下