struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas De Loof" <nicolas.del...@cgey.com>
Subject Re: File Upload size restriction ??
Date Mon, 30 Jun 2003 09:33:10 GMT
I'm using fileupload too and have difficulties to send errors about file size.

Are you able to send an error message with this code ?

In my application validate method returns errors (I can see it in logs) when file is too large,
but browser does'nt
display error JSP (waintg ...). I thing it is waiting for the file to be uploaded or something
like this.

I'm using tomcat 4.1.24 an IE 6 on Windows 2000.

Nico.


> Uups,
>
> found the answer in one of the strus-examples.
>
> Here it is for those who are interested.
>
> Regards
>
> Markus
>
>
>
>
>   /**
>       * Check to make sure the client hasn't exceeded the maximum
> allowed upload size inside of this
>       * validate method.
>       */
>      public ActionErrors validate(ActionMapping mapping,
> HttpServletRequest request)
>      {
>          ActionErrors errors = null;
>          //has the maximum length been exceeded?
>          Boolean maxLengthExceeded = (Boolean)
>
> request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED);
>          if ((maxLengthExceeded != null) &&
> (maxLengthExceeded.booleanValue()))
>          {
>              errors = new ActionErrors();
>              errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new
> ActionError("maxLengthExceeded"));
>          }
>          return errors;
>
>      }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message