You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mageshwaran <ma...@dhyanit.com> on 2009/03/26 07:36:10 UTC

About File UploadSizeLimitExceededException

Hi All,

I am using strust2* "s:file" *attribute tag for file upload to server. I 
am getting the following Exception,

2009-03-26 11:48:40,968 ERROR [Class] 
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: 
the request was rejected because its size (3203060) exceeds the 
configured maximum (2097152)
2009-03-26 11:48:40,968 ERROR [Class] the request was rejected because 
its size (3203060) exceeds the configured maximum (2097152)
2009-03-26 11:48:41,109 ERROR [Class] Could not find action or result

Can any one guide me how to solve this issue and to configure the size 
for file upload.

Thanks in advance,
Mageshwaran P.



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


RE: About File UploadSizeLimitExceededException

Posted by "Shannon, Andrew" <an...@pqa.com>.
I can't remember where I found this information its been so long since we added the configuration.  And now I'm not sure if its right.  But I do recall that when we added the property to struts.xml for:

<constant name="struts.multipart.maxSize" value="2097152"/>

that the value was a magic number.  Again, I just don't recall why.  We haven't hit the limit yet, but I'm going to test it now and see what happens.

Thanks,
Andrew

-----Original Message-----
From: Burton Rhodes [mailto:burtonrhodes@gmail.com] 
Sent: Thursday, March 26, 2009 10:01 AM
To: Struts Users Mailing List
Subject: Re: About File UploadSizeLimitExceededException

I had a similiar problem which I solved this way:

"struts.properties"
#This is for the file upload.  Set high on purpose, narrowed down
below at the action definition
struts.multipart.parser=org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest
struts.multipart.maxSize=100000000
struts.custom.i18n.resources=struts-messages

"struts-messages.properties"
# Error mesage when exceeding limit
struts.messages.error.uploading=Error uploading file.
struts.messages.error.file.too.large=A file you are trying to upload
exceeds the 5 MB maximum limit.

"struts.xml"
<action name="XactionAttachmentUpload_upload"
class="com.agentsymphony.web.action.xaction.XactionAttachmentUploadAction"
method="upload">
   <interceptor-ref name="fileUpload">
      <!-- 5 MB limit -->
      <param name="maximumSize">5242880</param>
   </interceptor-ref>
   <interceptor-ref name="myDefaultStack" />
   <result>xaction/xactionAttachmentUploadResults_popup.jsp</result>
   <result name="login">common/errorLogin_popup.jsp</result>
   <result name="error">xaction/xactionAttachmentUpload_popup.jsp</result>
   <result name="input">xaction/xactionAttachmentUpload_popup.jsp</result>
</action>


On Thu, Mar 26, 2009 at 4:53 AM, Mageshwaran <ma...@dhyanit.com> wrote:
> Hi Nils-H ,
>
> for the above issue, i had used "interceptor"  tag  in  struts config  xml
>  and the mapping is given below,
>
> <constant name="struts.multipart.maxSize" value="10000000" />
> <action name="importDCMeterXLSFile"
>
> class="com.echelon.nem.client.configuration.struts.ImportDcMeterAction"
>               method="readXLSFile">
>               <interceptor-ref name="fileUpload">
>                   <param name="maximumSize">5203070</param>
>               </interceptor-ref>
>               <result
> name="success">/configuration/ImportDCMeter.jsp</result>
>       </action>
>
> and in JSP i am using <s:file name="fileUpload" label="File" size="20"
> onkeypress = "killEnter(event)"/> with encrypt type
> enctype="multipart/form-data".
>
> I am trying to upload a 3MB file.
> But i am getting exception "File too large" and returns Null in my action.
>
> Can any one suggest the solution for this issue.
>
> Thanks,
> Mageshwaran P.
>
> Nils-Helge Garli Hegvik wrote:
>>
>> Check the "maximumSize" parameter in the FileUploadInterceptor:
>> http://struts.apache.org/2.1.6/docs/file-upload-interceptor.html
>>
>> Nils-H
>>
>> On Thu, Mar 26, 2009 at 7:36 AM, Mageshwaran <ma...@dhyanit.com>
>> wrote:
>>
>>>
>>> Hi All,
>>>
>>> I am using strust2* "s:file" *attribute tag for file upload to server. I
>>> am
>>> getting the following Exception,
>>>
>>> 2009-03-26 11:48:40,968 ERROR [Class]
>>> org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException:
>>> the
>>> request was rejected because its size (3203060) exceeds the configured
>>> maximum (2097152)
>>> 2009-03-26 11:48:40,968 ERROR [Class] the request was rejected because
>>> its
>>> size (3203060) exceeds the configured maximum (2097152)
>>> 2009-03-26 11:48:41,109 ERROR [Class] Could not find action or result
>>>
>>> Can any one guide me how to solve this issue and to configure the size
>>> for
>>> file upload.
>>>
>>> Thanks in advance,
>>> Mageshwaran P.
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


Re: About File UploadSizeLimitExceededException

Posted by Burton Rhodes <bu...@gmail.com>.
I had a similiar problem which I solved this way:

"struts.properties"
#This is for the file upload.  Set high on purpose, narrowed down
below at the action definition
struts.multipart.parser=org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest
struts.multipart.maxSize=100000000
struts.custom.i18n.resources=struts-messages

"struts-messages.properties"
# Error mesage when exceeding limit
struts.messages.error.uploading=Error uploading file.
struts.messages.error.file.too.large=A file you are trying to upload
exceeds the 5 MB maximum limit.

"struts.xml"
<action name="XactionAttachmentUpload_upload"
class="com.agentsymphony.web.action.xaction.XactionAttachmentUploadAction"
method="upload">
   <interceptor-ref name="fileUpload">
      <!-- 5 MB limit -->
      <param name="maximumSize">5242880</param>
   </interceptor-ref>
   <interceptor-ref name="myDefaultStack" />
   <result>xaction/xactionAttachmentUploadResults_popup.jsp</result>
   <result name="login">common/errorLogin_popup.jsp</result>
   <result name="error">xaction/xactionAttachmentUpload_popup.jsp</result>
   <result name="input">xaction/xactionAttachmentUpload_popup.jsp</result>
</action>


On Thu, Mar 26, 2009 at 4:53 AM, Mageshwaran <ma...@dhyanit.com> wrote:
> Hi Nils-H ,
>
> for the above issue, i had used "interceptor"  tag  in  struts config  xml
>  and the mapping is given below,
>
> <constant name="struts.multipart.maxSize" value="10000000" />
> <action name="importDCMeterXLSFile"
>
> class="com.echelon.nem.client.configuration.struts.ImportDcMeterAction"
>               method="readXLSFile">
>               <interceptor-ref name="fileUpload">
>                   <param name="maximumSize">5203070</param>
>               </interceptor-ref>
>               <result
> name="success">/configuration/ImportDCMeter.jsp</result>
>       </action>
>
> and in JSP i am using <s:file name="fileUpload" label="File" size="20"
> onkeypress = "killEnter(event)"/> with encrypt type
> enctype="multipart/form-data".
>
> I am trying to upload a 3MB file.
> But i am getting exception "File too large" and returns Null in my action.
>
> Can any one suggest the solution for this issue.
>
> Thanks,
> Mageshwaran P.
>
> Nils-Helge Garli Hegvik wrote:
>>
>> Check the "maximumSize" parameter in the FileUploadInterceptor:
>> http://struts.apache.org/2.1.6/docs/file-upload-interceptor.html
>>
>> Nils-H
>>
>> On Thu, Mar 26, 2009 at 7:36 AM, Mageshwaran <ma...@dhyanit.com>
>> wrote:
>>
>>>
>>> Hi All,
>>>
>>> I am using strust2* "s:file" *attribute tag for file upload to server. I
>>> am
>>> getting the following Exception,
>>>
>>> 2009-03-26 11:48:40,968 ERROR [Class]
>>> org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException:
>>> the
>>> request was rejected because its size (3203060) exceeds the configured
>>> maximum (2097152)
>>> 2009-03-26 11:48:40,968 ERROR [Class] the request was rejected because
>>> its
>>> size (3203060) exceeds the configured maximum (2097152)
>>> 2009-03-26 11:48:41,109 ERROR [Class] Could not find action or result
>>>
>>> Can any one guide me how to solve this issue and to configure the size
>>> for
>>> file upload.
>>>
>>> Thanks in advance,
>>> Mageshwaran P.
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: About File UploadSizeLimitExceededException

Posted by Mageshwaran <ma...@dhyanit.com>.
Hi Nils-H ,

for the above issue, i had used "interceptor"  tag  in  struts config  
xml  and the mapping is given below,

<constant name="struts.multipart.maxSize" value="10000000" />
<action name="importDCMeterXLSFile"
                
class="com.echelon.nem.client.configuration.struts.ImportDcMeterAction"
                method="readXLSFile">
                <interceptor-ref name="fileUpload">
                    <param name="maximumSize">5203070</param>
                </interceptor-ref>
                <result 
name="success">/configuration/ImportDCMeter.jsp</result>
        </action>

and in JSP i am using <s:file name="fileUpload" label="File" size="20" 
onkeypress = "killEnter(event)"/> with encrypt type
enctype="multipart/form-data".

I am trying to upload a 3MB file.
But i am getting exception "File too large" and returns Null in my action.

Can any one suggest the solution for this issue.

Thanks,
Mageshwaran P.

Nils-Helge Garli Hegvik wrote:
> Check the "maximumSize" parameter in the FileUploadInterceptor:
> http://struts.apache.org/2.1.6/docs/file-upload-interceptor.html
>
> Nils-H
>
> On Thu, Mar 26, 2009 at 7:36 AM, Mageshwaran <ma...@dhyanit.com> wrote:
>   
>> Hi All,
>>
>> I am using strust2* "s:file" *attribute tag for file upload to server. I am
>> getting the following Exception,
>>
>> 2009-03-26 11:48:40,968 ERROR [Class]
>> org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the
>> request was rejected because its size (3203060) exceeds the configured
>> maximum (2097152)
>> 2009-03-26 11:48:40,968 ERROR [Class] the request was rejected because its
>> size (3203060) exceeds the configured maximum (2097152)
>> 2009-03-26 11:48:41,109 ERROR [Class] Could not find action or result
>>
>> Can any one guide me how to solve this issue and to configure the size for
>> file upload.
>>
>> Thanks in advance,
>> Mageshwaran P.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>   


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


Re: About File UploadSizeLimitExceededException

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Check the "maximumSize" parameter in the FileUploadInterceptor:
http://struts.apache.org/2.1.6/docs/file-upload-interceptor.html

Nils-H

On Thu, Mar 26, 2009 at 7:36 AM, Mageshwaran <ma...@dhyanit.com> wrote:
> Hi All,
>
> I am using strust2* "s:file" *attribute tag for file upload to server. I am
> getting the following Exception,
>
> 2009-03-26 11:48:40,968 ERROR [Class]
> org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the
> request was rejected because its size (3203060) exceeds the configured
> maximum (2097152)
> 2009-03-26 11:48:40,968 ERROR [Class] the request was rejected because its
> size (3203060) exceeds the configured maximum (2097152)
> 2009-03-26 11:48:41,109 ERROR [Class] Could not find action or result
>
> Can any one guide me how to solve this issue and to configure the size for
> file upload.
>
> Thanks in advance,
> Mageshwaran P.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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