enctype="multipart/form-data"这个问题?

解决方案 »

  1.   

    我用file就是为了上传文件啊,那个肯定要指定的了
      

  2.   

    出在js函数上!
      <SCRIPT   LANGUAGE=javascript>  
      <!--  
      function   _submit(key){  
      if(key==0){  
      frm.encoding="multipart/form-data";  
      }else{  
      frm.encoding="application/x-www-form-urlencoded";  
      }  
      frm.submit();  
      }  
      //-->  
      </SCRIPT>   
      

  3.   

    看这个:http://topic.csdn.net/t/20020705/11/851965.html
      

  4.   

    这样?还是不行哦,还是拒绝访问啊.
    看了楼上的那贴,但是问题没解决,那贴主要讲数据取不到吧,我目前是不能提交.
    =============================
    <html>
    <style>
    input{border:1px solid green;}
    </style>
    <script> function  doSubmit(key){  
      if(key==0){  
      form1.encoding="multipart/form-data";  
      }else{  
      form1.encoding="application/x-www-form-urlencoded";  
      }  
      form1.submit();  
      }   </script><body>
    <form name="form1" method="post" action="6.html" enctype="multipart/form-data">
    <table>
    <tr><td>
    <input type="text" id="txt" name="txt">
    &nbsp;&nbsp;<input type="button" onmousemove="f.style.pixelLeft=event.x-60;f.style.pixelTop=this.offsetTop;" value="请选择文件" size="30" onclick="f.click()">
    <input type="file" id="f" onchange="txt.value=this.value" name="f" style="position:absolute;filter:alpha(opacity=0);" size="1" hidefocus><BR>
    </td></tr>
    <tr><td>
    <INPUT TYPE="button" name="submit1" onclick="javascript:doSubmit();" value="submit"/>
    </td></tr>
    <table>
    </form>
    </body>
    </html>
      

  5.   

    <!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>
    <title>test</title>
    <style> 
    input{border:1px solid green;} 
    </style> 
    <script> 
    function doSubmit(){ 
    document.form1.submit(); 

    </script> 
    </head>
    <body> 
    <form name="form1" method="post" action="6.html" enctype="multipart/form-data"> 
    <div> 
    <input type="text" id="txt" name="txt"> 
    &nbsp;&nbsp; <input type="button" onmousemove="f.style.pixelLeft=event.x-60;f.style.pixelTop=this.offsetTop;" value="请选择文件" size="30" onclick="f.click()"> 
    <input type="file" id="f" onchange="txt.value=this.value" name="f" style="position:absolute;filter:alpha(opacity=0);" size="1" hidefocus> <BR> 
    </div> 
    <div> 
    <INPUT TYPE="button" name="submit1" onclick="javascript:doSubmit();" value="submit"/> 
    <div> </form> 
    </body> 
    </html>
    你可以使用div啊!!
    干吗要用table
    DIV也可以做跟TABLE的效果
      

  6.   

    兄弟我不擅长div+css的玩意啊,我需要个4行4列,列不等宽的表格,我自己写的div+css的表格达不到用table时的效果.
      

  7.   

    这个问题我也遇到过,也在网上查了很久,得到一个大概的结论是,如果你在js中调用了文件框的click事件,然后又调用了submit事件就会出现这个情况.好像是浏览器或者js的安全限制阻止了这次提交
    你如果是要替换文件框的浏览按钮的话,给你个思路,把文件框设置成透明的,覆盖到你页面上假的文件框上面,这样点击的话还是点击的文件框.
      

  8.   

    今天貌似已经解决了,这里的代码里面是用的button,我换了个img然后漂在透明的file上,也不调用file.click 实现了我要的结果,表格,层都可以随便用,基本和楼上的说的差不多.
      

  9.   

    嗯.楼主 我也有个疑问哦:
     Submit按钮默认的不就可以提交吗? 所以我想,照8楼kofsbcat朋友的分析话,如果把这个Button的click事件去掉,是不是同样也可以正常提交了呢?嘿嘿