我用fileupload做的上传,其中是从主页面到上传页面,我在上传页面,单击后退返回主页面的时候,tomcat报错,希望高手指点迷津!很是郁闷啊!
主要错误为:org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null

解决方案 »

  1.   

    在form中加 enctype="multipart/form-data"
      

  2.   

    AreamArgentateOfWing(梦幻银翼) 正解
      

  3.   

    在form中加 enctype="multipart/form-data"就是这个你说的触发事件是指什么!
      

  4.   

    我的程序如下,没有"后退 "的问题
    <%@page contentType="text/html; charset=GB2312"%>
    <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
    <html:html>
           <!--
          The most important part is to declare your form's enctype
          to be "multipart/form-data", and to have an html:file
          element that maps to your ActionForm's FormFile property
        -->
      <html:form action="/List/File.do"  method="POST" enctype="multipart/form-data">
       <table width="790" align="center" cellspacing="1" cellpadding="0" border="0">
       <tr>请选择你需要备份的文件:</tr><p>&nbsp</p>
       <tr><html:file property="file" value="浏览"/> <br/><br/></tr>
        <html:submit value="提交" style="bg"/>
        </table >
      </html:form>
      <p>
      <table width="790" align="center" cellspacing="1" cellpadding="0" border="0">
        <logic:notEmpty name="fileForm" property="fname">     你已经备份的文件:
          <p>
          <ul>
            <li>文件名称 :<bean:write name="fileForm" property="fname"/>
            <li>文件大小 :<bean:write name="fileForm" property="size"/>
          </ul>
        </logic:notEmpty>
        </table></html:html>
      

  5.   

    谢谢各位了,我改好了,好象是servlet的问题,我又单写了一个servlet,这样就OK了