Mike,

I tried setting the maxFileSize as follows;

    <init-param>
      <param-name>maxFileSize</param-name>
      <param-value>100K</param-value>
    </init-param>

This throws a MaxLengthExceededException as expected.  I would like to catch
this exception and show a user friendly message on the screen.  How can I do
that?  Please help....


Here's what I am doing;

1)  I unzipped the struts-upload.war file that came with Struts 1.0.  (I
believe you wrote this sample app - thanks!)
2)  In the web.xml I made the changes shown above.
3)  I ran this app in Weblogic 5.1 (sp 9) and Tomcat 3.2.3.  In both cases,
when I submit a file larger than 100K I get
a MaxLengthExceededException and I get Error 500 - Internal Server Error on
the screen.


Here's my understanding of the problem - Please ignore this if it doesn't
make sense...

This exception is thrown in the BufferedMultipartInputStream constructor.
Shouldn't this exception be passed all the way up to the
ActionServlet.processPopulate()?  This method has access to the
'formInstance' which can be used to notify the user.  Does this make sense?

Anyway, any help in this matter will be greatly appreciated.  Thanks.

- Ajay



-----Original Message-----
From: SCHACHTER,MICHAEL (HP-NewJersey,ex2) [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 10:18 AM
To: '[EMAIL PROTECTED]'
Subject: RE: file upload problems


Ricky,

The maximum upload size is represented as an init-param for ActionServlet:

To set it as an init-param in web.xml:

<servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>maxFileSize</param-name>
      <param-value>100K</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>

The value of "maxFileSize" can be represented as in bytes by not appending
any
characters to the end, kilobytes by appending a "K" at the end, megabytes by
appending an "M" at the end, and gigabytes by appending a "G" at the end.

Example:

100 bytes:
<servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>maxFileSize</param-name>
      <param-value>100</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>

100 kilobytes:

<servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>maxFileSize</param-name>
      <param-value>100K</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>

100 Megabytes:

<servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>maxFileSize</param-name>
      <param-value>100M</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>

100 Gigabytes
<servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>maxFileSize</param-name>
      <param-value>100G</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>



-----Original Message-----
From: Ricky Frank [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 12:29 PM
To: [EMAIL PROTECTED]
Subject: RE: file upload problems


Can you also provide an example of the tag for limiting the size of the
file uploaded?  Or is this not supported?  I've dug through some of the
underlying code and it looks like it is but I don't see anything in the tag
definition on how to invoke this limitation.  Thanks.  Ricky Frank

At 12:10 PM 9/10/2001 -0400, you wrote:
>Rightfully Disgruntled File Upload Users,
>
>I'll set aside some time next week to address
>all the file upload issues, I apologize for the
>long delay.
>
>In the interim, please use bug reports
>(http://nagoya.apache.org/bugzilla/)
>to report all file upload issues that you
>come across.  Check to see if it's reported,
>if not, go ahead and do so.  This notifies
>me directly.
>
>
>-----Original Message-----
>From: Tom Tibbetts [mailto:[EMAIL PROTECTED]]
>Sent: Monday, September 10, 2001 9:59 AM
>To: [EMAIL PROTECTED]
>Subject: file upload mangling files
>
>
>Hi.  What's the status on fixing the file upload problem of files getting
>mangled?  I use Struts ver 1.0.  Is there a fix available??? Thanks, This
>is very important to us.  Tom Tibbetts


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to