日期:2014-05-16  浏览次数:20366 次

JSP 上传文件报错
http://s.yanghao.org/program/viewdetail.php?i=72625

http://www.iteye.com/topic/212566?page=1
*默认文件上传的大小是250M     
*/      
public static final long DEFAULT_SIZE_MAX = 250 * 1024 * 1024;       
/**     
*上传文件在内存中使用的缓冲区大小,超过次数值的数据写入硬盘。     
*/      
public static final int DEFAULT_SIZE_THRESHOLD = 256 * 1024;  

/**   
*默认文件上传的大小是250M   
*/   
public static final long DEFAULT_SIZE_MAX = 250 * 1024 * 1024;    
/**   
*上传文件在内存中使用的缓冲区大小,超过次数值的数据写入硬盘。   
*/   
public static final int DEFAULT_SIZE_THRESHOLD = 256 * 1024;


这样:在struts-config文件中写配置:
Xml代码 
<!-- ========== Controller Configuration ================================ --> 
 
       <controller> 
 
              <!-- The "input" parameter on "action" elements is the name of a  
 
                     local or global "forward" rather than a module-relative path --> 
 
              <set-property value="true" property="inputForward" /> 
              <set-property value="text/html; charset=UTF-8" 
                     property="contentType" /> 
              <!-- 通过写类的全名来替代struts默认的MultipartRequestHandler -->               
 
              <set-property property="multipartClass"   
value="com.amplesky.commonmodule.struts.AmpleskyMultipartRequestHandler" /> 
              <!-- 规定的上传文件的最大值 --> 
              <set-property property="maxFileSize" value="15M" /> 
              <!--  缓冲区大小 --> 
              <set-property property="memFileSize" value="5M" />