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 <[email protected]> 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 <[email protected]>
>> 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: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]