If i try to upload a file of more than 2 MB size its error-ed.
I found in apache web site saying "There are two separate file size limits. First is struts.multipart.maxSize which comes from the Struts 2 default.properties file. This setting exists for security reasons to prohibit a malicious user from uploading extremely large files to file up your servers disk space. This setting defaults to approximately 2 megabytes and should be adjusted to the maximum size file (2 gigs max) that your will need the framework to receive"
So I found that this issue can be solved by adding the tag with the desired max limit <constant name="struts.multipart.maxSize" value="1000000" />
in struts.xml file.
We are using struts2-convention-plugin, so we don't have struts.xml. So I was not sure where to define this max file size...
Please let me know if any one of you have come across on this..
Appreciate for your help.
You can define a max size in Struts.xml (multipart.maxSize , as you said) to limit the overall transfer for each multipart request;
You can also define a file Size for the FileUpload Interceptor (default 2MB), both globally to a package, and for a single Action (by configuring that parameter for that Interceptor in the <action>
tag in struts.xml, or by Annotating it inside the Action when using the Convention plugin:
<interceptor-ref name="fileUpload">
<param name="maximumSize">10485760</param>
</interceptor-ref>
This means that if, for example, you configure an overall multipart size of 20 MB, a maximumSize-per-file of 4MB, you will be able to perform a multiple upload of 5 files of 4MB in a single request;
More info here: https://stackoverflow.com/a/15968166/1654265
That said, your problem is a non-problem;
using Convention plugin does not mean you don't have a struts.xml; it means that
Nowhere in the Convention Plugin Documentation, is mentioned that it is mutually exclusive to the struts.xml (instead, if you try to search on that page "struts.xml", you will find several occurrences)