Upload file size limit

2004-11-03 Thread Diego
Hi! I want to prevent the users from uploading files bigger than 1 MB,
so I've put this on my struts-config:

controller nocache=true inputForward=false maxFileSize=1M/

The problem is that, AFAIK, when the max file size is exceeded, the same
Action which receives the file is invoked with this attribute in the
request:

MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED

The problem is that I'm using DispatchAction on my app, and when the
file size is exceeded, Struts is invoking my DispatchAction with no
arguments, so I get an error.

Do I have something wrong in my config or it's possible to change this
behaviour? I've thought of creating a normal Action to receive file
uploads, but I would want to avoid this, if possible.

Thanks in advance


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Upload file size limit

2004-11-03 Thread Andrew Hill
One technique would be overriding dispatchactions execute method in that 
action to check for this attribute and then delegating back to the 
superclass to handle the normal situation when its not found or calling 
the appropriate method when it is?

ie:
public ActionForward execute(ActionMapping mapping, ... )
{
  if( request.getAttribute( 
MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED) != null)
  {
return myMethod(mapping, ...)
  }
  else
  {
return super.execute(mapping, ...);
  }

}
Diego wrote:
Hi! I want to prevent the users from uploading files bigger than 1 MB,
so I've put this on my struts-config:
controller nocache=true inputForward=false maxFileSize=1M/
The problem is that, AFAIK, when the max file size is exceeded, the same
Action which receives the file is invoked with this attribute in the
request:
MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED
The problem is that I'm using DispatchAction on my app, and when the
file size is exceeded, Struts is invoking my DispatchAction with no
arguments, so I get an error.
Do I have something wrong in my config or it's possible to change this
behaviour? I've thought of creating a normal Action to receive file
uploads, but I would want to avoid this, if possible.
Thanks in advance
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]