Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/06/2011, 02:14
harkonen
 
Fecha de Ingreso: mayo-2011
Mensajes: 79
Antigüedad: 12 años, 11 meses
Puntos: 14
Respuesta: Problema al subir imagenes struts2

Código:
There are two separate file size limits. First is struts.multipart.maxSize which comes from the Struts 2 default.properties file. This setting exists for security reasons to prohibit a malicious user from uploading extremely large files to file up your servers disk space. This setting defaults to approximately 2 megabytes and should be adjusted to the maximum size file (2 gigs max) that your will need the framework to receive. If you are uploading more than one file on a form the struts.multipart.maxSize applies to the combined total, not the individual file sizes The other setting, maximumSize, is an interceptor setting that is used to ensure a particular Action does not receive a file that is too large. .Notice the locations of both settings in the following example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC 
	"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" 
	"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
    <constant name="struts.multipart.maxSize" value="1000000" />
    
    <action name="doUpload" class="com.example.UploadAction">
        <interceptor-ref name="basicStack"/>
        <interceptor-ref name="fileUpload">
            <param name="maximumSize">500000</param>
        </interceptor-ref> 
        <interceptor-ref name="validation"/>
        <interceptor-ref name="workflow"/>

        <result name="success">good_result.jsp</result>
    </action>
</struts>
En el default.properties se fija a 2Mb por defecto el valor total máximo de subida por archivo. Cámbialo y listo.

Saludos
__________________
Web Admin:
http://www.coretec.es
Tutoriales, Noticias y Recursos Liferay y J2EE